Salomon Rondon scored twice in Malaga's 4-2 win over Rayo Vallecano on Thursday to vault the home side into the hunt for the Champions League qualification places.
Manuel Pellegrini's team, who grabbed a 1-1 draw at leaders Real Madrid last weekend, are level on 44 points with fourth-placed Levante with 10 matches left to play.
Venezuelan striker Rondon headed the hosts level after Diego Costa had fired Rayo in front from the penalty spot early on.
A great solo effort saw Rondon bag his second in the 57th minute while Enzo Maresca and Duda, with a looping long-range shot, secured the points for the Qatar-owned club.
Rayo had pulled a second goal back from the penalty spot to make it 3-2 with six minutes left.
Earlier, Uruguayan striker Walter Pandiani grabbed a last-minute equaliser for Espanyol in their 1-1 draw at Real Betis, a result that put them sixth with 40 points.
Sevilla's 3-0 win at Racing Santander, with a double from Manu del Moral, left the hosts deep in relegation trouble in 18th. Racing are four points from safety with 24, the same as Sporting Gijon in 19th.
Basement side Real Zaragoza climbed on to 22 points after a surprise 2-1 win at Valencia on Wednesday.