Venezuelan forward Solomon Rondon scored twice as Malaga beat Rayo Vallecano 4-2 on Thursday to move into fifth position in La Liga, level on 44 points with Levante and just three behind third-placed Valencia.
Rayo went ahead with a Diego Costa penalty on five minutes after Jesus Gamez had tripped Emiliano Armenteros.
However, Rondon got a goal in either half, first with a header and then with a great piece of finishing to put the home side ahead.
Enzo Maresca made it 3-1 on 70 minutes with his first touch, scoring a header from a pinpoint Jesus Gamez cross.
Roberto Trashorras converted another penalty on 84 minutes for the side from Madrid to make it 3-2.
However, two minutes later, another Malaga subsitute, Duda, scored when he hit a left footed shot from 30 yards to round of a deserved win for the side from the Costa del Sol.
Sevilla had an easy 3-0 away win at struggling Racing Santander to boost their hopes of European competition next season.
Spanish international Jesus Navas got the opener in the first-half for the visitors before Manu del Moral hit a second-half double.
Racing had Papa Diop sent off with a straight red card for a foul on Piotr Trochowski with 12 minutes remaining and stay in the relegation zone.
Real Betis drew 1-1 at home to Espanyol for whom Walter Pandiani grabbed a last-minute equaliser after Ruben Castro had headed the home side into the lead on 78 minutes.