Osasuna ensured they will be playing Primera Division football again next season after fighting back from a goal down to defeat Sevilla at the Reyno de Navarra.
Alvaro Negredo put European hopefuls Sevilla ahead just after half-time but Patxi Punal drew Osasuna level around the hour-mark and then substitute Alvaro Cejudo curled home a free-kick with 12 minutes remaining to earn the hosts all three points.
The victory, combined with defeats for relegation rivals Real Zaragoza and Deportivo La Coruna, means Osasuna are now five points above the drop zone with just one game remaining, ensuring they now cannot finish in the bottom three.
Osasuna came the closest to opening the scoring during a goalless first half with Miguel De las Cuevas heading against a post and visiting goalkeeper Antonio Beto twice denying Emiliano Armenteros.
Sevilla were not without an attacking threat either, though, with Alberto Botia testing Osasuna custodian Andres Fernandez just before the break.
And it was the visitors who went ahead four minutes into the second half when Negredo, who has been linked with a move away from the Andalusian club this summer, cleverly finished off a pass Jesus Navas.
Osasuna were behind for less than 15 minutes before Punal drew them level with another fine goal, the 37-year-old finding the roof of the net from long range.
Joseba Llorente came close to putting Osasuna ahead in the 75th minute, Beto brilliantly parrying the striker's effort, but the hosts did not have to wait much longer to net what would prove to be the match-winning goal, thanks to Cejudo.
Cejudo had only been on the pitch eight minutes after replacing De las Cuevas when he stepped up to take a free-kick 25 yards out, earned by Gary Medel's foul on Punal, and fired an unstoppable shot past Beto into the far top corner - the third memorable goal of the match.
That put Osasuna within touching distance of a potentially vital win, and their goalkeeper Fernandez ensured they would get it by superbly saving Negredo's late shot with his feet.