Emmanuel Boateng scored in the third minute of stoppage time to give Levante a 1-0 win against Malaga, relegating the bottom club to the second tier for the first time in 10 seasons.
The visitors created the better chances before the break, but keeper Roberto had to save Levante midfielder Jose Campana's effort seconds after the restart.
Roger Marti went close for the home side and Maxime Lestienne for Malaga as time ran down, but Boateng's last-gasp contribution secured the points and ended the visitors' feint survival hopes.
The result left Malaga 17 points behind 17th-place Levante, the first team outside the drop zone. Levante is seven points ahead of 18th-place Deportivo La Coruna.