Ten-man Real Madrid rescued a 3-3 draw at home to Las Palmas on Wednesday thanks to a late double from Cristiano Ronaldo.
Goals from Tana, Jonathan Viera and Kevin-Prince Boateng overturned an early opener from Isco and looked set to give the visitors a shock three points, especially after Gareth Bale's red card early in the second half.
But Ronaldo struck twice in three minutes in the closing stages to salvage a point for Zinedine Zidane's side that could yet prove important in the LaLiga title race, though it was not enough to take them back above Barcelona, who earlier thrashed Sporting Gijon 6-1.
Isco, rewarded with a start for his performance off the bench in the 3-2 win at Villarreal, opened the scoring after eight minutes, but a fine solo goal from Tana drew the visitors level almost immediately.
Las Palmas displayed composure on the ball that belied the form they have shown in a run of four consecutive defeats and Bale's frustrations got the better of him early in the second half as he picked up two bookings for fouling Viera before pushing him to ground.
Viera compounded Madrid's anger when he made it 2-1 from the penalty spot and Boateng netted his seventh goal of the season before the hour mark following a Keylor Navas error.
Ronaldo proved the salvation with a late penalty and a thumping header, but although Madrid can consider the result a point gained, both Barca and Sevilla have nonetheless been handed a major boost.
3 - Real Madrid have conceded three goals in a game at Santiago Bernabeu for the first time under Zinedine Zidane (all competitions). Bomb. pic.twitter.com/3oHSG9Hw0C — OptaJose (@OptaJose) March 1, 2017
Alvaro Morata had the ball in the net with just 30 seconds played, only to see the offside flag raised, but Isco exploited the visitors' uncertain defence to put Madrid ahead after eight minutes.
Mateo Kovacic threaded a fine throughball into Isco's path, with Dani Castellano failing to step up in time, allowing the midfielder to slot beyond Javi Varas from 12 yards.
Las Palmas needed only two minutes to level the scores, though, as Tana left Sergio Ramos for dead with a brilliant turn before charging into the box from the right and blasting high past Navas.
The visitors looked impressive on the ball without causing further undue problems for Navas, and it was Madrid who came closest to a third goal, with Ramos heading straight at Varas from close range.
A sense of dissatisfaction was beginning to build around the Santiago Bernabeu as Madrid struggled to create attacking inroads, but Bale made matters considerably harder for his side with two quick-fire yellow cards just two minutes into the second half, with a petulant kick and subsequent shove of Viera earning the Wales star an early bath.
It went from bad to worse before the hour mark, with Ramos penalised for blocking David Simon's shot with his arms after winning a tackle in the area, allowing Viera to make it 2-1 from 12 yards despite Navas getting a leg to the spot-kick.
Navas' annoyance was clear, but he was culpable for Las Palmas' third just three minutes later. Viera sent a simple long pass over Marcelo and into Boateng's path, and when Madrid's goalkeeper rushed off his line and failed to connect with the ball, Boateng had an easy finish.
4 - Keylor Navas has made more errors leading to goals than any other La Liga player this season (all competitions). Strange. — OptaJose (@OptaJose) March 1, 2017
Zidane's side sought an instant response and Ramos clattered the crossbar following Isco's free-kick, but Navas was called upon to twice thwart Jese Rodriguez from making it 4-1 on his Bernabeu return.
Ronaldo picked up a booking for simulation and had a goal-bound shot cleared off the line, but he handed Madrid a lifeline when he fired a penalty into the top-right corner after Castellano was penalised for handball.
And Ronaldo completed the scoring in a remarkable game in the 89th minute, powering James Rodriguez's corner through the grasp of Varas to secure a share of the spoils, leaving Madrid a point behind Barca with a game in hand.