Real victory delays Barca title for another week
If Real had failed to win, victory for Barca against Real Betis at the Nou Camp on Sunday would have secured a fourth title in five years as they would have been at least 13 points clear with only four games left and 12 points available.
Jose Mourinho's Real side are refusing to relinquish their league crown without making it as difficult as possible for their bitter rivals in the final weeks of the campaign even if they gave up on the title several months ago after a poor start.
"We will keep working," Real's Portugal defender Pepe told Spanish television.
"We know that it's a tough ask but we represent a very important club and we will honour the shirt to the end."
Valladolid, who have not won a point at the Bernabeu in more than a decade, took a surprise eighth-minute lead when Oscar Gonzalez stole in on the right and beat Real goalkeeper Diego Lopez with a low shot.
Real were level in the 26th minute when Marc Valiente deflected an Angel di Maria shot into his own net before Ronaldo nodded the first of his two headers six minutes later.
Valladolid struck back almost immediately when Javi Guerra finished off a swift breakaway in the 35th minute and Kaka restored Real's lead four minutes after the break.
Ronaldo looked to have killed off the game 20 minutes from time when he headed home from a corner, the Portugal forward's 33rd league goal of the campaign.
But there was still time for substitute Lluis Sastre to smash home a third for the visitors to set up a nervy finish.
Real's victory lifted them to 77 points from 34 matches, eight behind Barca and eight ahead of third-placed Atletico Madrid, who were held to a 0-0 draw at Deportivo La Coruna in the late kick-off.
Valencia stayed in the hunt for a Champions League berth with a thumping 4-0 win at home to nine-man Osasuna but Malaga's hopes of a return to Europe's elite club competition faded when they lost 1-0 at Granada.
Valencia striker Roberto Soldado started the rout at the Mestalla in the 39th minute when he netted the rebound from a Jonas shot and Ricardo Costa nodded a second for the home side a minute before half-time.
Osasuna defender Alejandro Arribas was shown a straight red card in the 58th minute when he felled Soldado as he bore down on goal and Ever Banega stroked the resulting free-kick in off the underside of the crossbar.
Osasuna's miserable afternoon was completed when David Timor picked up a second yellow card 15 minutes from time and Jonas made it 4-0 from the penalty spot in the fourth minute of stoppage time after a handball in the area.
Valencia are fifth on 56 points from 34 of 38 matches, two behind Real Sociedad, who occupy Spain's fourth and final Champions League spot.
After outperforming on their Champions League debut by reaching the quarter-finals this season, Malaga's defeat leaves them in sixth, three points behind Valencia and four ahead of Real Betis.
Fifth and sixth earns an automatic place in the Europa League, the continent's second-tier club competition.
Odion Ighalo scored the winner for Granada in the Andalusian derby in the 28th minute when he cleverly diverted an Allan Nyom cross into the net past Malaga goalkeeper Willy Caballero.
The victory lifted them to 15th on 35 points, two ahead of Osasuna in 16th and three ahead of 17th-placed Depor.