Malaga dropped out of La Liga’s top four on Saturday after a 2-1 defeat at home to Real Sociedad.
The surprise win was Sociedad’s first in five games and was thoroughly deserved against Malaga, who are bound for the Champions League knockout stages.
Carlos Vela gave the visitors the lead in the opening minute, but Argentine Javier Saviola’s equaliser levelled things in the 37th minute.
Sociedad went ahead for good just before the hour mark with Xabi Prieto’s goal handing them the three points.
The win drags Sociedad out of the relegation zone and puts Malaga 10 points behind leaders Barcelona.
Elsewhere, Osasuna defeated fellow cellar dwellers Espanyol 3-0 to end a streak of five defeats.
Alvaro Cehudo put Osasuna ahead in the first half before second-half goals from Kike Sola and Manuel Omwu made sure of the win.
Portugal international Helder Postiga netted a brace for Real Zaragoza as they came from two goals down in a see-sawing 5-3 win over 10-man Deportivo La Coruna.
Deportivo went 2-0 up early on through Bruno Gama and Riki but were reduced to 10 men shortly after Apono scored for Zaragoza to make it 2-1.
Pizzi was given a second yellow card for diving four minutes after the restart and that gave Zaragoza the incentive to score four second-half goals through Paco Montanes, Alvaro Gonzalez and Postiga’s brace.
The win moves Zaragoza up to eighth while Deportivo remain in the drop zone.
In similar fashion, Rayo Vallecano produced a second-half comeback against 10-man Celta Vigo to win 3-2 after trailing by two goals before half-time.
Gustavo Cabral’s sending off just before the break swung the game in Vallecano’s favour and they went on to score three times in the second half, with the winner coming from Piti eight minutes from time.