Málaga has completed a more than satisfactory season under tactician Manuel Pellegrini with a 1-0 win over Sporting de Gijón at La Rosaleda to finish in fourth spot with 58 points.
Salomón Rondón scored the goal on 49 minutes that beat Gijón with a superb pass from Santi Cazorla and guaranteed Málaga their first ever qualification for the Champions League. Defeat for Sporting means they drop into the second division after four successive seasons in the top flight.
The Andalusian side, under Pellegrini for its first full season started the stronger and Juan Pablo in the visitors' goal had to make an acrobatic save from Eliseu on 17 minutes.
Then the Venezuelan Rondón hit the post with a powerful header and with the game goalless at the interval Málaga's dream was on hold. However, it was Rondón who headed home a corner on 49 minutes to ease the nerves and send the packed Rosaleda crowd into celebration.
Algerian striker Abdelkader Ghezzal scored twice to help Levante to a 3-0 win over Athletic Bilbao and reward their magnificant season with a Europa League place.
He raced onto a long ball from centre-half Gustavo Cabral to lob over the advancing Bilbao goalkeeper Gorka Iraizoz on the stroke of half-time for his first.
Jose Barkero supplied him for the second and Francisco Farinós got a last minute penalty to send Levante into European competition for the first time.
At the bottom, Villarreal were relegated along with Sporting in a dramatic 90 minutes in which any two of five teams were facing the drop.
Villarreal lost 1-0 at home to Atlético Madrid for whom Colombian international Radamel Falcao scored with two minutes remaining to condemn last season's Europa League semi-finalists to the second-tier for the first time since 1998-99.
Coach Miguel Ángel Lotina, who suffered a similar fate last season with Deportivo La Coruña, was distraught.
"It's difficult to explain what has happened. After winning in Gijón we had it in our hands, but last week we conceded a late goal and tonight again with a header from a corner. Football has been very unfair with Villarreal," he said.
Marco Rubén and Marcos Senna went close from distance in a first-half in which the team battling relegation were the stronger.
All seemed under control until Falcao headed home and almost immediately a goal from Raul Tamudo for Rayo Vallecano at home to Granada turned things around completely.
Until that stage, Rayo Vallecano were in the relegation zone and 60 seconds from the drop.
Veteran forward Tamudo came off the bench to prod home a header from close range to send Villarreal to the second division and save the tiny club from the south of Madrid.
Antonio Galdeano 'Apoño' and Hector Postiga gave Zaragoza the 2-0 win they needed at eight-man Getafe and finish a miraculous end of season in which they won eight out of the last 11 games to guarantee safety.
The home side had Pablo Sarabia sent-off for two yellow cards within seconds for protesting on 25 minutes.
Zaragoza also had cause to complain when the referee denied them a penalty when it seemed Postiga had been wrestled to the ground just before the interval.
On 56 minutes, Miguel Torres was also sent-off for a handball in the area and Apoño hit home from the spot.
Zaragoza lost a man late on when substitute Tomislav Dujmovic was dismissed before Miku left the home side with eight players and Postiga scored a last minute second to seal their survival.y finalizó en la cuarta posición de la Liga.
*Photo courtesy of Getty Images