Pablo Franco’s side knew victory would guarantee them another season in the top flight ahead of the final two rounds of matches but they were undone by a goal in each half as Rayo climbed above David Moyes’ Real Sociedad into 11th place.
Getafe’s Uruguayan defender Emiliano Velazquez put through his own net in the 28th minute before Rayo’s Venezuelan substitute Miku settled matters in the final quarter.
Both sides were reduced to 10 men three minutes from time when Rayo’s Javier Aquino and Getafe’s Roberto Lago were sent off for violent conduct.
Manucho and Alberto Bueno passed up early chances for Rayo before Lago saw his effort at the other end saved by David Cobeno.
Rayo took the lead when Velazquez sliced his right-footed clearance into his own net and Ze Castro almost added a second after the break.
But former Getafe striker Miku piled the misery on the club he left in the January transfer window when he accepted Roberto Trashorras’ pass and finished superbly.
Gael Kakuta was prevented from adding further gloss in the final seconds by a fine Vincente Guaita save.