The result cut Barcelona's lead at the top to eight points and although they can't now mathematically seal the title with a win over Real Betis on Sunday, they can restore their 11-point lead with just four games remaining.
The visitors had taken a shock lead early on as Oscar Gonzalez slotted past Diego Lopez from a narrow angle.
However, Marc Valiente's own goal and a Ronaldo header put Madrid 2-1 in front before Javi Guerra finished off a flowing Valladolid move to ensure they went into half-time on level terms.
Kaka restored the hosts' advantage just after the break and Ronaldo looked to have sealed the points when he again found the net with his head 21 minutes from time.
Valladolid were given a late lifeline though when Oscar scored his second of the evening with a sensational long-range volley that found the bottom corner.
But Real held on to ensure a disappointing week given their failure to reach the Champions League final on Tuesday did end with some consolation.
Defender Pepe said it is important to keep going until the end of the season just in case Barca, who were also dumped out of the Champions League in midweek, struggle to get across the line.
"We need to do our job and then see what happens," he told Canal Plus.
"We are representing a very big institution that is Real Madrid and we need to have respect for that. Therefore, we need to face every game like this even if theoretically it doesn't matter.
"We conceded a lot of goals, we didn't start the game well and I think we have to pressure a little more, but in any case we managed to react."
The hosts had been caught cold early on when a slack crossfield pass from Angel Di Maria was intercepted by Oscar and he galloped clear behind the Real defence before slotting past Lopez at his near post.
The goal seemed to spark Madrid into life though and after Kaka had forced Jaime Jimenez into a fine flying save, they were level on 26 minutes when Di Maria cut inside and saw his goalbound drive deflected into his own net by Valiente.
Jose Mourinho's men continued to force the pace after drawing level and went in front six minutes later as Ronaldo rose highest to meet Di Maria's in-swinging cross to flick home his 32nd league goal of the season.
Just three minutes later Valladolid were level again though as a wonderful pass from Oscar released Omar Ramos down the left and his low cross was turned in at the far post by Guerra.
The hosts were back in front just three minutes after the restart as Karim Benzema played in Kaka and Jaime couldn't keep the Brazilian's shot out despite getting a hand to it.
Ronaldo then just failed to get over Fabio Coentrao's cross as another headed effort drifted over before Mourinho introduced Mesut Ozil and Xabi Alonso in a bid to finish the game off.
And just two minutes later from Ozil's corner Ronaldo again leapt highest to nod his second of the afternoon into the far corner.
However, some late slackness from Real allowed Valladolid back into the game and after Patrick Ebert could only turn Antonio Rukavina's cross onto the roof of the net, Oscar did half the deficit with a sensational volleyed strike from fully 30 yards into Lopez's bottom left-hand corner.