Jeremy Mathieu and Daniel Parejo were on target for the visitors to seriously damage Carlo Ancelotti's side's chances of winning the league this season.
Real Madrid failed to capitalize on slips by its rivals as Valencia applied further drama to La Liga’s title race with a 2-2 draw in the Santiago Bernabeu.
Following Barcelona’s draw with Getafe on Saturday and a 2-0 defeat for leaders Atletico Madrid at Levante earlier on Sunday, Carlo Ancelotti’s team looked in pole position for the title.
But Valencia had not read that script and goals from Jeremy Mathieu and former Real youth product Daniel Parejo either side of Sergio Ramos’ equalizer looked to have handed Juan Antonio Pizzi’s side a famous triumph.
Visiting goalkeeper Diego Alves was magnificent throughout, routinely thwarting Cristiano Ronaldo, but the Portuguese finally got the better of him in stoppage time to earn a point.
Despite rescuing a draw, it is Real's local rivals Atletico who appear to be in the best shape. Victory in its final two matches - including the much-anticipated season-ending encounter with Barca at Camp Nou - will hand it the title.
For Valencia, the performance provided a tonic to Thursday's last-gasp UEFA Europa League semifinal elimination at the hands of Sevilla.
Real still has La Decima to chase in the UEFA Champions League, but now requires a huge favor from fierce enemy Barca on the final day to take the title.
Ancelotti’s men quickly hit their stride, Ronaldo beginning his game-long duel with Alves as early as the third minute.
As Madrid failed to build on its start, Parejo found himself unmarked on the end of Sofiane Feghouli's wonderful right-wing cross 16 minutes in, but Diego Lopez tipped his header onto the crossbar.
It was Alves' turn to impress again after 26 minutes as Ronaldo stormed past Ricardo Costa, only to see his strike palmed around the post.
Valencia served further warning of its intentions when Paco Alcacer failed to get a decisive touch on Eduardo Vargas' low cross and, after Alves thwarted Ronaldo once more, it claimed a 44th-minute advantage.
Lopez was at full stretch in touching Feghouli's strike over the bar but erred by staying on his line from the resulting corner and Mathieu scored, the ball ultimately finding the net via his shoulder.
Ancelotti sent Angel di Maria on at the interval, and the Argentina midfielder's energy immediately boosted the hosts.
After saving from Di Maria, Alves again kept out Ronaldo but, after Raphael Varane spurned a set-piece chance, Real’s pressure finally told.
Ramos was still up from an earlier attack and enjoyed a tap-in when Ronaldo headed across goal in the 59th minute - netting for the fourth time in Real's last three outings.
With the game seemingly at its mercy, Real allowed the action to drift and, following a scrappy passage of play, Valencia poured forward, Parejo steering clinically into the corner from Feghouli's pass.
Ronaldo sought an instant response from close range, but Alves again excelled, tormenting the FIFA Ballon d'Or winner with another stellar stop from a trademark free kick.
The Portugal captain's frustrations appeared to have gotten the better of him in the last 10 minutes as he sent a free header wide and had a penalty claim rejected.
But Real's talisman salvaged a point in stoppage time. Ronaldo produced an inventive stabbed volley from Di Maria's left-wing cross, though he should have secured a stunning triumph even deeper into the addition time, heading wide to keep Ancelotti's men second-best in the title race.