Spain were heading out of the World Cup for three minutes before Kai Havertz became a nation's unlikeliest hero.
At 2-1 down to a Japan side who staged a remarkable second half fightback, Spain slipped below both the Japanese and Costa Rica in Group E and looked to be heading for the exit when the Costa Ricans took a 2-1 lead against Germany.
However, German substitute Havertz then struck twice to turn the tables and drop Costa Rica down to the bottom of the table.