(CNN) -- Goal machine Cristiano Ronaldo scored two first half goals in quick succession to power Real Madrid to a 2-0 win over Malaga in the Bernabeu, but also earned his second red card of the season.
Ronaldo's strikes all but sealed victory for Real by halftime, but he blotted his copybook with a flying elbow earning him his marching orders in the 70th minute, his second dismissal this season.
But it was a much-needed win for Real, who cut the gap at the top on Barcelona, who won 3-0 at Valladolid on Saturday, to five points.
Malaga had the better of the early exchanges and might have taken a shock lead before a fine team move led to Kaka feeding his fellow superstar Ronaldo from the right.
He duly converted with a first time shot for a 35th minute opener and three minutes later he was on the scoresheet again, connecting on the volley with Guti's clever pass forward to score his second.
Just before halftime Ronaldo might have completed his hat-trick as a trademark free kick was parried away but he has scored 15 goals in 16 games for Real this season.
In other matches on Sunday, Tenerife held third-placed Valencia to a 0-0 draw while Real Mallorca went fourth on goal difference ahead of Deportivo La Coruna after claiming a 1-1 draw at Espanyol.
Valencia showed little of the form which saw them dispatch Villarreal 4-1 last week and aside from a deflected David Silva shot which went close and a David Navarro header offered scant threat in attack.
Pablo Osvaldo gave Espanyol the lead just after halftime with Bonja Valero equalizing from the spot in the 80th minute.