Madrid: Villarreal have been promoted back to the Primera Division at the first time of asking as they beat promotion challengers Almeria 1-0 at El Madrigal on Saturday night.
With both sides locked on 74 points before kick-off, the winner would join Elche in being automatically promoted and Jonathan Pereira got the crucial goal for the hosts 10 minutes into the second-half.
Defeat for Almeria means that they will now have to go through the playoffs if they are to return to the top-flight for the first time since the 2010/11 season.
The Andalusians will face Las Palmas in a two-legged tie with Girona playing Alcorcon in the other playoff semi-final.
At the bottom, Racing Santander were relegated for the second consecutive season as despite their 3-0 win over Hercules, Murcia's 1-0 victory against Las Palmas was enough to secure their survival.