Barcelona move up to second, just two points adrift, despite a below-par display in edging past bottom-placed Granada 1-0 thanks to Rafinha's spectacular winner.
Atletico Madrid remain three points back of city rivals Real thanks to doubles from Yannick Carrasco and Kevin Gameiro in a 4-2 win over Malaga despite playing with 10 men for the final half hour.
Ronaldo's wayward form in recent weeks had come under the spotlight -- even drawing whistles from the Santiago Bernabeu crowd last weekend -- but he turned the game around after Deyverson had put Alaves into a shock early lead.
"We knew how to suffer because the first half and the start of the second weren't comfortable or easy.
Also Read
"But playing like this, if you know how to suffer and then add a bit of movement, we know what we can do."
Real's unbeaten run stretches to 26 matches, but their defensive struggles continued in Vitoria as Zidane's men got off to the worst possible start when Deyverson pounced on an error from goalkeeper Keylor Navas to slot Alaves into a seventh-minute lead.
Firstly, Deyverson was adjudged to have handled a Gareth Bale free-kick inside his own area and Ronaldo slotted home the penalty.
Ronaldo's second came 16 minutes later when his low effort from outside the area deflected off Zouhair Feddal and flew into the far corner.
The Portuguese missed the chance to seal his hat-trick when his second spot-kick was saved by Fernando Pacheco 12 minutes from time.
However, Alvaro Morata again made his presence felt off the bench as he raced onto Marcelo's through ball and lobbed the onrushing Pacheco for his fourth goal as a substitute this season.
An injury-ravaged Barcelona named Lionel Messi, Luis Suarez and Neymar in attack against winless Granada, but had to rely on free-scoring midfielder Rafinha in a much closer contest than anticipated at the Camp Nou.
"It is clear it wasn't a brilliant match on our part," admitted Barca boss Luis Enrique.
Rafinha's overhead kick broke the deadlock three minutes
into the second-half after Barca toiled to break down Granada's deep-lying defence before the break.
Neymar, Suarez and Messi all missed chances to add a second, but Granada never threatened to end their record of losing in every one of their now 24 visits to the Camp Nou.
Carrasco fired home his sixth goal in his last six games to put Atletico in front before Gameiro took advantage of some slack Malaga defending to double the lead inside 25 minutes.
Sandro Ramirez's stunning free-kick brought Malaga back into the game, but Gameiro restored Atletico's two-goal lead when he latched onto Antoine Griezmann's flick-on to make it 3-1 just before the break.
However, Stefan Savic picked up two quickfire yellow cards to leave Atletico a man short for the final half hour.
"I think he has improved with a lot of hard work and sacrifice. He has understood his own potential," Atletico boss Diego Simeone said of Carrasco.
"Today he scored a goal with his left foot and then another one on his right on the counter-attack with the finish of a striker."
Sevilla slip to fourth after being held 1-1 at Sporting Gijon.