Rayo Vallecano inflicted Malaga's first home defeat of the season thanks to two goals by Piti in a 2-1 win.
The midfielder opened the scoring from Leo Baptistao's driven cross on 11 minutes but after squandering a number of chances towards the end of the first half, the visitors were pegged back four minutes into the second period as Martin Demichelis headed home Joaquin's free-kick.
Rayo responded brilliantly to conceding and after a sustained spell of pressure, they got the winner they deserved on the hour mark when Leo again teed up Piti to fire into the bottom corner for his fourth goal of the season.
The Madrid side had lost six of their previous seven matches but have consistently made fast starts away from home this season and they scored first for the fourth time in five league games on the road when Leo turned Weligton inside the area and his driven effort, which may have been intended as a shot at goal, turned into the perfect cross for Piti to side-foot home.
Javier Saviola then had two chances to bring Malaga back into the game but he just could not get enough on Francisco Portillo's cross to turn the ball in before David Cobeno produced a flying save to turn away another shot from just inside the area.
Cobeno then made another fine stop to turn away a fierce effort from Joaquin before frantic Rayo defending somehow conspired to block a goalbound effort from Isco on the line.
However, the visitors' defending was not so sharp just after the break as a simple ball in from a free-kick saw Demichelis in space to head in his second goal of the season.
After the equaliser, though, it was all Rayo as Piti had a cross deflected just over his own crossbar by Jesus Gamez and then fired another low effort from outside the area off the outside of the post.
Jose Carlos should also have scored when he headed wide a few seconds later but the goal was coming and eventually arrived when skilful play from Leo saw him skip past two forlorn Malaga challenges before laying the ball off for Piti, who took a touch before prodding the ball into the bottom corner.
Malaga tried to force a late onslaught on the Rayo goal but lacked their usual cohesion and Diego Buonanotte's shot from the edge of the area that was palmed away by Cobeno was the closest they came.
The win moves Rayo into the top half whilst Malaga will now almost certainly end the weekend outside the top four.