The result has seen Cosmin Contra's side finish the season three points above the drop zone, with Osasuna and Real Valladolid joining Real Betis in the Segunda Division next season.
It was the visitors who created the first meaningful chance of the match on 31 minutes when Angel Lafita shot narrowly wide of the post.
Getafe continued to press and they were awarded with the game's opening goal on 43 minutes as Ciprian Marica fired powerfully into the bottom corner.
Both teams struggled to threaten during a cagey second half, but Vallecano netted an equaliser with 67 minutes played thanks to Roberto Trashorras's impressive free kick.
Getafe posed more of a danger as the match wore on and they should have gone in front with seven minutes remaining. However, Marica somehow fired over the crossbar from close range.
Although a draw would have been enough to keep them in the top flight, Getafe sealed the win deep in added time when Marica scored from the penalty spot following a foul by Ruben Ivan Martinez.