The Portuguese forward made up for the absence of record signing Gareth Bale, who was denied a home debut after injuring a thigh muscle in the warm-up, with a 34th-minute penalty to put his side 2-1 up and a 90th-minute fourth.
The win moved the hosts back to with two points of Primera Division leaders Barcelona and Atletico Madrid in third place.
The did it the hard way, though, with Angel Lafita's deflected shot putting the visitors in front after only five minutes.
Pepe pounced to level from close range in the 20th minute and Ronaldo turned the game on its head before the break, slotting a penalty into the bottom corner after a handball by Michel.
Isco, who replaced Bale in the starting line-up, made it 3-1 just before the hour mark.
Ronaldo, fresh from his hat-trick against Galatasaray in the Champions League in midweek, got his second of the game after Michel had been sent off for a second yellow card in the 85th minute.
Valencia ended a run of four straight losses in all competitions with a 3-1 home win over Sevilla thanks to a brace from Jonas.
The Brazilian opened the scoring in the 32nd minute and restored the hosts' lead 17 minutes from time following Kevin Gameiro's equaliser early in the second half.
Victor Ruiz Torre headed a third in the 82nd minute to seal a much-needed victory for Valencia which moved them up to ninth.
Elsewhere, the matches between Celta Vigo and Villarreal and Real Betis and Granada both ended goalless.