Watch: Lionel Messi scores 500th Barcelona goal with stoppage time winner against Real Madrid
Lionel Messi scored his 500th Barcelona goal as his stoppage-time winner against 10-man Real Madrid breathed life into his side's title challenge.
Messi - sporting a black eye and damaged teeth following Marcelo's first-half challenge - struck twice in a dramatic 3-2 win to take Barcelona to the top of LaLiga.
Ivan Rakitic was also on target for Barcelona, while Casemiro and James Rodriguez - the Colombian having equalised in the 85th minute - scored for hosts Real, who had captain Sergio Ramos sent off in the final quarter.
Ramos received an El Clasico red card for the second successive season 13 minutes from time after leaving the ground recklessly.
Messi was fortunate that the Spaniard's two-footed challenge did not make contact with him and that he avoided serious injury.
Barcelona go top because they have a better head-to-head record than Real, but Zinedine Zidane's team have a game on hand with six matches left to play.
The beat him, they bloodied him, he still could not be stopped, we are not worthy, Lionel Messi. pic.twitter.com/ziQcX8ltzN— A Dream of Highbury (@1886FC) April 23, 2017
This was a thrilling spectacle from start to finish, but one man stood tall on a dramatic night.
Messi's double took his goals in this fixture to 22 and set a new El Clasico LaLiga record of 16, eclipsing the mark of former Real great Alfredo Di Stefano.
But Messi kept his best for the final seconds, sweeping home Jordi Alba's cross into the corner of the net as the clock ticked into the second minute of stoppage time.
Masters champion Sergio Garcia - a Real fan - made an honorary kick-off and the action was soon as eventful as the Spanish golfer's Augusta triumph two weeks ago.
Real were convinced they should have been awarded a second-minute penalty when Cristiano Ronaldo fell under the challenge of El Clasico debutant Samuel Umtiti.
The France defender certainly made contact with Ronaldo's shin and Barcelona were grateful that referee Hernandez Hernandez showed no interest in Real's pleas.
Ronaldo was clearly fired up for the contest, drifting across the front line and stepping inside Gerard Pique to test Marc-Andre ter Stegen from 20 yards.
Barcelona, without the suspended Neymar, had been slow to get in to their stride, but Luis Suarez skewed two shots wide, while Karim Benzema was also guilty of some tame finishing at the other end.
There was little pause for breath, with Ter Stegen pushing out Ronaldo's low drive and Messi, who was beginning to find dangerous pockets of space, on the painful end of Marcelo's elbow.
Although it appeared a complete accident, Messi was left with blood pouring from his mouth and needed treatment on the sidelines before he was able to continue.
Messi returned holding a bandage to his mouth, but there was even greater pain for Barcelona as Real took a 28th-minute lead.
Marcelo's deep cross caught out a dozing Barcelona defence and Ramos hooked the ball against the post before Casemiro tapped home into an empty net.
But Barcelona were level within five minutes - and it was all down to the brilliance of the bloodied but unbowed Messi.
Suarez let Rakitic's pass run into Messi's path and the Argentinian swerved past Dani Carvajal to finish unerringly past Keylor Navas for his 499th Barcelona goal.
Real responded with Luka Modric bringing a full-length save from Ter Stegen, but the hosts had to re-organise when Gareth Bale was forced off on the occasion of his 100th LaLiga appearance with what looked like a recurrence of an ankle injury.
It almost got worse for Real when Messi's shot flew narrowly wide off Carvajal, but Barcelona had their own moments of anxiety straight after the re-start.
Ter Stegen showed sharp reflexes to deny Toni Kroos and Benzema, but it was Real goalkeeper Navas who would become increasingly over-worked.
Navas kicked away Paco Alcacer's prodded effort and then reacted brilliantly to keep out Pique's bullet header.
The Costa Rican also denied Suarez from close range moments after Ronaldo had failed to beat Ter Stegen with the goal at his mercy.
Rakitic gave Barcelona the lead with a ferocious left-footed drive from 20 yards and Real's fate appeared sealed when Ramos was banished.
Pique missed the chance to secure victory and Rodriguez, who had only been on the pitch three minutes, looked as if he had handed Real a point.
But that was not taking into account the brilliance of Messi, who simply continues to take the breath away on a football pitch.