Richmond Boakye headed in an injury-time winner as Elche overcame fellow La Liga strugglers Getafe to pull five points clear of the drop zone.
Early on, Cristian Herrera fired just wide for home side Elche before Getafe threatened through Angel Lafita, whose shot came back off the post.
Both sides continued to have chances but it was Elche who struck in the dying seconds of the game.
Boakye leapt highest and sent the home fans delirious, moving Elche up to 14th in the table. Getafe remain just a point above the bottom three.