Real Madrid missed the chance to replace Barcelona at the top of La Liga ahead of Wednesday's Clasico but salvaged a 1-1 draw against Valencia as Karim Benzema scored a dramatic injury-time equaliser on Sunday.
Madrid goalkeeper Thibaut Courtois ventured up for a final corner at Mestalla and it was his header that caused panic in the Valencia box, before the ball fell perfectly for Benzema to strike in the 95th minute.
Valencia looked set for an impressive victory after Carlos Soler had put them ahead in the second half but both sides had to settle for a point at the end of a compelling contest between two of the league's form teams.
It means Barcelona remain top of the table but in front of Madrid only on goal difference, after they were also held to a 2-2 draw away at Real Sociedad on Saturday.
Madrid were celebrating at the final whistle but the result completes a strong week for Valencia, who won away at Ajax on Tuesday to go through as group winners to the Champions League last 16.
They stay eighth, now three points adrift of the top four.
Real Madrid have been on a good run too, now 10 matches unbeaten to crank up the pressure on Barca and leave behind their early-season stumbles that had put Zinedine Zidane's future in doubt.
Zidane had said on Saturday nobody at the club would be looking ahead to the Clasico prematurely and while the draw against Valencia may mean an opportunity was missed, their late show still sends them to Camp Nou with a spring in their step.
Benzema, in particular, will be a key threat. The Frenchman had Courtois to thank for his latest effort but he now has 15 goals already this season and nine in his last eight games.
Zidane left Casemiro on the bench, with the Brazilian one yellow card away from a suspension. Gareth Bale also started as a substitute but came on in the second half, putting him in contention for a start in midweek.
Madrid had the better of the early stages as Benzema rose to meet Nacho Fernandez's cross but headed wide before Rodrygo peeled free at the back post but nodded into the hands of Jasper Cillessen.
Valencia grew in confidence as the half wore on, with Ferran Torres testing Courtois and then almost racing clear after a slip by Sergio Ramos, only for Courtois to intercept just in time.
The contest remained in the balance early in the second period as Madrid shaded possession but Valencia looked dangerous on the break.
Both teams fancied a winner as Celades brought on another forward in Manu Vallejo while Zidane threw on Bale and Vinicius Junior for Rodrygo and Isco with just over 20 minutes left.
Valencia thought they had snatched it as Nacho was beaten in the air and Daniel Wass skipped free down the right.
His pull-back was just angled enough to evade the stretching leg of Raphael Varane and find Soler, who smashed in.
But Madrid poured forward late on. Luka Jovic, on as a substitute, poked in but was ruled out for offside.
Then in the last play of the game, Courtois marauded up for a corner and it was his head that first met Toni Kroos' cross.
Cillessen palmed away but Valencia failed to clear and in the scramble, Benzema struck.