Barcelona, who won 2-1 at Las Palmas on Saturday, have 63 points to Real's 54 with 13 matches of the season remaining. Atletico Madrid, who play at home to Villarreal later on Sunday, are level on points with city rivals Real.
Ronaldo put Real ahead when he rose unmarked to send a looping header from a Toni Kroos free kick over Carlos Kameni and in under the bar in the 33rd minute for his 22nd league goal of the season.
He was denied a second three minutes later when Kameni dived to his left to save the striker's penalty after he had been brought down by Weligton.
World Cup
How are World Cup group stages decided by a tie-breaker?
Malaga scored a deserved equaliser in the 66th minute when central defender Raul Albentosa, unmarked in the middle of the box, volleyed home a cross from the left.
World Cup
What do England need to qualify for the Last 16? How can Wales spoil the party?
World Cup
Between 400 and 500 migrant worker deaths from World Cup projects, says Qatar 2022 chief