Germany crashed out of the World Cup on a remarkable night of drama despite victory over Costa Rica at Al Bayt Stadium.
Japan’s 2-1 win against Spain – which saw them finish top of Group E – would have eliminated Germany anyway thanks to Spain’s superior goal difference.
Hansi Flick’s side needed victory to give themselves any chance of reaching the last 16, but it was to no avail.
Germany were in complete control and led through Serge Gnabry’s 10th-minute header only for Costa Rica to turn the match on its head to raise the remarkable possibility of Spain also going out.
Yeltsin Tejeda equalised after Germany keeper Manuel Neuer pushed out Kendall Waston’s header in the 58th minute, before Juan Pablo Vargas bundled in a second 12 minutes later. At that stage, they were going through with Japan.
It would have capped one of the most astonishing nights in World Cup history, but Germany substitute Kai Havertz restored a measure of normality to proceedings with two clinical finishes. Niclas Fullkrug’s last-minute effort gave Flick’s side a win that was no consolation as they failed to get out of the group stage for the second successive World Cup.