Elsewhere, Valencia's hopes of qualifying for the UEFA Champions League suffered a setback, while Levante also dropped points in their pursuit of Europe.
Diego Simeone's Atletico Madrid surrendered their 100 per cent home record in La Liga in 2012/13 as they lost 1-0 to Real Sociedad at Vicente Calderon in the late kick-off.
The visitors took the victory through Xavi Prieto's 53rd minute breakaway goal to move level on points with fourth-placed Malaga in the chase for the Champions League places.
Real Madrid had earlier overtaken their city rivals for the first time this season and returned to 13 points behind bitter rivals Barcelona at the Primera Division summit after a 2-1 win over Celta Vigo.
Ronaldo scored a scrappy opener and a winner from the penalty spot, after Iago Aspas' equaliser, to take his tally to 188 goals in 186 appearances for the club.
Iker Muniain scored his first goal of the season as Athletic Bilbao overcame Valencia at San Mames to record a victory that eased their fears of being dragged into a relegation fight.
The result was also a blow to Valencia's plans of qualifying for the Champions League, as Ernesto Valverde's side, who were knocked out of Europe's elite competition by Paris Saint-Germain on Wednesday, missed the chance to capitalise on Malaga's draw on Saturday and claim fourth spot.
Levante missed the chance to move closer to the Europa League places as Getafe survived a one-sided goalless draw at the Ciutat de Valencia.
The east-coast outfit reached 36 points and 10th place courtesy of the stalemate - their highest-ever points tally at this stage of a Primera Division season - but they were left to rue a chronic lack of incision in front of goal.