Lionel Messi scored his 500th Barcelona goal to send the Catalans top of La Liga with a last-minute winner against 10-man Real Madrid at the Santiago Bernabeu on Sunday.
The victory in the El Clasico put Barcelona level on points with Real Madrid, but with a better goal difference and head-to-head record.
Casemiro had put the hosts ahead in the 28th minute before Messi and Ivan Rakitic goals in the 33rd and 73rd minutes respectively put Barcelona in front.
Sergio Ramos was shown a red card in the 77th and substitute James Rodriguez thought he had earned Madrid a point late on.
But Messi, who scored his first with a superb run and finish, fired in from the edge of the area to win it for Barcelona in the 90th minute.
Both Messi and Cristiano Ronaldo had earlier missed good opportunities to give their sides the lead, with the Argentina international poking wide of an open goal before the break and Ronaldo slicing over in the second half.