Lionel Messi scored his 500th Barcelona goal with the last kick of the game to snatch a stunning 3-2 win at Real Madrid and put the two teams level on points at the top of La Liga on Sunday.
James Rodriguez appeared to have rescued a point for hosts Real Madrid with an 86th-minute strike to make it 2-2 after goals by Messi and Ivan Rakitic had overturned Casemiro's opener.
Madrid captain Sergio Ramos was sent off for a two-footed lunge on Messi in the 77th minute and that left Barcelona in a strong position, until Rodriguez fired home at the near post.
But Messi’s second goal in the final minute of added time earned Barca a vital win in the title race that leaves both sides with 75 points, although Madrid have a game in hand.
The match was a thriller which will go down as one of the best Clasicos in history, with end-to-end action from the off.
Cristiano Ronaldo was furious when Samuel Umtiti tripped him in the box and referee Alejandro Jose Hernandez waved away his appeal, but Barcelona were complaining afterwards when Marcelo got away with an elbow on Messi.
The Argentine came in for harsh treatment throughout, with Casemiro lucky not to be sent off for multiple hacks on him after picking up an early booking for a foul.
The Brazilian opened the scoring for Madrid in the 28th minute, tapping home at the back post after Ramos had fired Marcelo’s cross against the post.
Five minutes later Barcelona were level and it was Messi who finished it, dancing away from Dani Carvajal and slotting the ball beyond Keylor Navas.
Gareth Bale went off injured towards the end of the first half and was replaced by Marco Asensio. The youngster set up Ronaldo in the second period but the Portugal international blasted over from close range.
Rakitic made him pay with a long-range strike that flew beyond Navas, and then Ramos was dismissed as he lunged in on Messi recklessly.
Rodriguez levelled the score after he reached Marcelo’s near-post cross but Messi had the final say, blowing the title race wide open.