Barcelona moved top of La Liga on the night Luis Enrique confirmed he will not continue as coach next season as Gareth Bale was sent-off in Real Madrid's thrilling 3-3 draw at home to Las Palmas.
Enrique announced his decision to step down after Barca's 6-1 rout of Sporting Gijon earlier on Wednesday which leaves Barcelona a point clear at the top, but having played a game more.
Bale's first ever red card in a Madrid shirt look set to cost the European champions dear as Las Palmas led the 10 men 3-1 with just three minutes remaining.
However, Cristiano Ronaldo struck twice in an incredible finale to salvage a point.
Madrid's slip up, though, means a third title in as many seasons for Enrique is back in Barcelona's hands with the two sides still to meet in April.
"I will not be the coach of Barcelona next season," Enrique said, citing the need for a break from the pressures at the Camp Nou as the reason for his decision.
"It is a difficult, measured and well thought out decision and I think I have to be loyal to what I think."
After Barca had swept aside Sporting with all of Lionel Messi, Luis Suarez and Neymar on the scoresheet, Madrid also looked in for an easy night at the Bernabeu when Isco slotted home the opener after just eight minutes.
However, Real were in front for just two minutes before Tana spun Sergio Ramos on the edge of the box before firing high past Keylor Navas.
The game turned just three minutes into the second-half when Bale uncharacteristically lost his temper after a late challenge from Jonathan Viera.
The Welshman pushed Viera to the ground and was punished with a red card.
"He has apologised. He is not happy with the sending-off," said Real Madrid boss Zinedine Zidane.
Things got much worse for the hosts in the next 10 minutes as, firstly, Viera converted from the penalty spot after a clear handball by Ramos inside the area.
And then a huge mistake from Navas allowed Kevin-Prince Boateng to knock the ball past the Costa Rican as he flew from his goal before rolling the ball into an empty net.
Ronaldo to the rescue
However, despite their numerical disadvantage, Madrid laid seige to the Las Palmas goal and were rewarded in the final minutes.
Ronaldo fired a penalty into the top corner after Dani Castellano was penalised for handball.
And the World Player of the Year then bulleted home a header from a corner a minute from time to salvage a point.
"We are not leaders, but the league is still open and we are not going to give up," added Zidane.
Barca enjoyed a far more comfortable night against a Sporting side still mired in the relegation zone.
Messi netted his 36th goal in as many games this season in unusual fashion on his 500th start before Juan Rodriguez's own goal made it 2-0.
The visitors were handed a brief lifeline when Carlos Castro pulled a goal back.
However, there was no time for any Barca doubts to seep in as Suarez's spectacular volley restored their two-goal lead.
Paco Alcacer was given a rare chance for the second half as he replaced Suarez and took just four minutes to make it 4-1 when he slotted home from Messi's pass.
Messi also hit the bar from a trademark free-kick before the five-time World Player of the Year was rested for the final half hour as he was replaced by Andre Gomes.
Neymar took advantage of the Argentine's absence to take over free-kick duty and he produced a stunning strike of his own into the top corner for his first La Liga goal at the Camp Nou this season.
Ivan Rakitic completed the scoring when he lashed into the roof of the net three minutes from time.