The hosts bounced back from their Champions League elimination at the hands of Borussia Dortmund to keep the La Liga title race alive for one more weekend at least.
The build-up to the match was dominated by the future of coach Jose Mourinho and his expected departure to Chelsea, but, should he leave, Ronaldo is one player he would certainly miss.
He helped the hosts recover from conceding an early goal to Oscar, making it 2-1 after Angel Di Maria had levelled.
Javi Guerra equalised before the break for the visitors, but second-half efforts from Kaka and Ronaldo looked to have got Madrid home and dry.
Sastre's brilliant volley got Valladolid a late third, but there was no dramatic equaliser.
The win saw Madrid close the gap on Barcelona to eight points ahead of their home match with Real Betis on Sunday.
Valladolid took a shock lead after eight minutes, Oscar firing low into the net from 12 yards.
It silenced the same Bernabeu crowd which had been so raucous in the final minutes of the semi-final second leg with Dortmund, but their team responded in the right way.
Luka Modric shot wide and Kaka over in the space of a minute before Di Maria levelled in the 26th minute with a low shot from the right of the area.
And Ronaldo completed the turnaround in the 32nd minute, heading Di Maria's right-wing cross home.
But Madrid were stunned again with three minutes.
Omar's pass set up Javi Guerra and slid his shot into the bottom corner from close range.
Almost immediately Ronaldo had a shot from edge of the area parried by Jaime before the keeper saw a brilliant 30-yard free-kick from the Portugal forward thunder back off the bar.
They went back in front four minutes after the restart, Karim Benzema sending in Kaka to finish.
Pepe headed over from a Modric free-kick before another Ronaldo header gave Madrid a two-goal cushion.
Mesut Ozil swung in a corner from the right and the Ronaldo rose highest to power it home.
It left him just one goal away from his double century in all competitions for the club he joined in 2009.
Diego Lopez then did well to push a shot from Oscar behind after initially spilling a shot from the edge of the area, while the keeper then had to scramble back to tip away an audacious attempted lob from the same player.
But he could do nothing to prevent Sastre pulling one back three minutes from time, scoring with a perfectly-executed 25-yard volley into the bottom corner.
Valladolid could not find a fourth, though, as Madrid held on.