Cristiano Ronaldo's first-half score was the only difference between Real Madrid and Malaga as Carlo Ancelotti's side claimed a 1-0 win at Estadio La Rosaleda.
The Portugal international fired home a low strike after beating three Malaga defenders in the 23rd minute to claim a narrow victory for Real which put the pressure back on capital rivals Atletico Madrid who lie second in the overall standings.
The result left Malaga in 13th place but only three points clear of the relegation zone.
Ronaldo started off on the front foot and tested Malaga goalkeeper Willy Caballero with a strike from the edge of the area shortly after he forced a block from Marcos Angeleri.
Isco went close from a corner but Malaga also had an early chance when Roque Santa Cruz headed over from close range in the 13th minute.
However, it was Real who broke the deadlock midway through the first half when Ronaldo received a ball from Gareth Bale in the left of the box, cut back inside and curled it into the bottom of the net.
That proved to be the only goal of the game despite several chances for both sides, with Caballero making an excellent save with his feet to deny Ronaldo just over a minute after his score.
City rivals Atletico responded later on in the evening, beating Espanyol 1-0 through Diego Costa's second-half winner.
After a cagey opening 45 minutes, Atletico began the second half well and they went ahead 10 minutes in after Diego Costa picked up Villa's cross from the left and made no mistake as he curled it into the bottom of the net from 12 yards out for his 29th goal of the season.
Despite a late onslaught, the visitors could not find an equaliser and the defeat leaves them ninth after just one win in their last four league games.
Elsewhere, Levante fell 1-0 to Celta Vigo, while Rayo Vallecano ran out comfortable 3-1 winners against Almeria.