Diego Castro's late own goal at Getafe kept Rayo Vallecano's Europa League dream alive but their battle for seventh place in the Primera Division could still be in vain.
Rayo came from behind to win the local derby at the Coliseum Alfonso Perez as Alejandro Dominguez cancelled out Rafa Lopez's opener before Castro put through his own net at the death.
Paco Jemez's men can depose Real Betis with victory over Athletic Bilbao on the final day, given their superior head-to-head record, but Rayo have been denied a European licence due to financial concerns.
While the Spanish Football Federation considers Rayo's appeal, the Madrid outfit must win once more while praying Betis slip up at Levante.
After nine minutes Franco Vazquez tamely headed Piti's cross over the bar.
Federico Fernandez then fouled Dominguez on the edge of his box to allow Getafe a sniff on goal, but Miguel Moya pulled off a splendid save on Roberto Trashorras' curling free-kick. Moments later, Dominguez volleyed over the bar with Moya rooted to the spot.
Getafe took the initiative as Pedro Leon forced a brave block from Jordi inside the six-yard box and Leon was in the mix again when his corner found Castro, who drilled past a post.
With time ticking away to half-time Rayo bared their teeth, Jose Carlos beating the defence but missing the target from 30 yards.
It was Getafe who took the lead three minutes after the interval. Leon had caused Rayo problems with his earlier corner and this time he found a diving header from Rafa, who bulleted the ball into the bottom corner.
The visitors did level in the 53rd minute, though, when Dominguez picked his spot from 12 yards to leave Moya standing.
Ruben Martinez stood up to Angel Lafita's rocket as Getafe turned up the pressure and, at the other end, Moya plucked Jose Carlos' snapshot out of the air.
With 10 minutes to go victory was still up for grabs and Rayo substitute Alhassane Bangoura announced himself with a piledriver aimed at Moya.
The Guinean forward - who had replaced the injured Piti - played a decisive role in Rayo's victory by slamming the ball against Castro and in.
Andrija Delibasic offered to claim the goal from the embarrassed Getafe winger, but how it had arrived mattered little to grateful Rayo.