The result leaves Madrid 16 points behind top placed Barcelona on 54, Atletico Madrid are second on 43, Valencia third on 40 with Real another two back.
Real manager Zinedine Zidane was able to field his favoured forward line of Ronaldo, Gareth Bale and Karim Benzema for the first time in 279 days.
This was no walk in the park for Zidane’s men who had to fight until two late strikes from Marcelo and then Toni Kroos relieved the tension.
On a sunny afternoon at an animated Mestalla stadium with it’s impeccable turf and rowdy Curva Nord stand, Valencia, a club back on their feet after a decade of turmoil, had only lost once at home this season and gained a 2-2 draw at the Bernabeu in August.
Valencia’s fast, confident, counter-attacking bamboozled Madrid defenders Raphael Varane and Nacho from the off and the home team also looked menacing from corners.
From one Valencia corner, however, Bale headed down to Ronaldo who tore down the field, passing to Marcelo and advancing into the Valencia box where Martin Montoya fouled the Portuguese superstar as he collected a pass.
Ronaldo sent Neto the wrong way on 17 minutes and added a second penalty, for his eight league goal of the season, after Montoya fouled him again.
Having only lost at the Mestalla to Villarreal this season Marcelino Garcia’s collection of loan signings and youngsters showed magnificent will as they fought to get back into the game.
Rodrigo missed a gaping open goal for the hosts just before half-time.
Just before the hour 22-year-old Spanish striker Santi Mina lost Nacho and stole in at a corner to pull a goal back with a well directed header. It was his third goal in three games.
Bale, who showed all his old pace, was then booked for telling the referee he needed glasses. Television replays suggested Bale had a good point.
As for Benzema, he was largely reliable in build up play although he seemed reluctant to shoot, but as he trudged off when substituted looking as depressed as the Spanish press claim he is.
With tension building, Ronaldo might have scored three times, failing to convert after great work from Bale and Luka Modric and sending a free-kick sizzling narrowly wide.
Marcelo finished brilliantly to relieve Madrid nerves after a tearing run and cut in from the left culminated in a fierce low drive into the bottom corner.
Zidane, who has been in charge at Madrid since January 2016 after Rafael Benitez was fired after a defeat in Valencia, looked visibly relieved.
Kroos then put the cherry on Madrid’s cake with a precise strike from outside the area with Valencia fading.