Natxo Insa scored the only goal as Celta Vigo survived relegation from the Primera Division with a close win over Espanyol.
The midfielder struck after 15 minutes as the home side avoided the drop to the delight of a packed Balaidos as overjoyed fans swarmed on to the pitch at the final whistle.
Celta stayed up at the expense of Deportivo La Coruna, who were relegated after being beaten 1-0 at home by Real Sociedad.
Espanyol went close when Simao Sabrosa sent in a free-kick from the right but Celta Vigo goalkeeper Ruben Blanco proved equal to the effort after four minutes.
The home side took the lead in the 15th minute when Iago Aspas crossed from the left and Insa shot into the top right corner of the goal from inside the area.
Things got worse for Espanyol three minutes later when Sergio Garcia was booked for deliberate handball.
The next chance fell to Joan Verdu but the Espanyol midfielder shot wide of the target.
Garcia was off target as Espanyol kept up the pressure and then Christian Stuani volleyed over the bar from close range.
Celta Vigo's Carlos Bellvis shot over from distance before Alex Lopez's header was comfortable for Espanyol goalkeeper Francisco Casilla.
Blanco made a brilliant save to tip Garcia's header over and then pushed Verdu's shot around the post.
Garcia shot wide on the hour as Espanyol pressed for an equaliser but the home side could have added to their lead with 12 minutes to go, only for Aspas' shot to be blocked by Casilla.
Aspas was on hand in his own area when he cleared a Simao corner at the near post.
With five minutes to go Celta's Michael Krohn-Delhi was off target as he tried to extend the home side's lead.
However, Celta were able to see out time and their delighted fans flocked on to the pitch when their survival was assured at the end of the game.