A 4-2 win over Costa Rica wasn't enough to send Germany through to the knockout stages of the World Cup, as Japan pulled off an upset against Spain.
After taking just one point from their first two games, Germany knew they had to win tonight to keep their dreams of going through alive. Hansi Flick's team were made to fight hard for that win, but they ultimately got the three points they needed.
But, unfortunately for Germany, a two-goal win wasn't enough to seal a spot in the round of 16 because Japan caused an upset against Spain in the other game in the group, winning 2-1 to move to first place.
Having beaten Costa Rica 7-0 in their opening match, Spain go through as runners-up thanks to a superior goal difference to Germany.
Despite dominating possession and chances from start to finish, Germany were left trailing in the second half as Serge Gnabry's first-half opener was followed by goals from Tejeda and Vargas.
Kai Havertz then turned the game around for Germany, bagging a brace, before Niclas Füllkrug added to the lead in injury time, making it 4-2.
All Germany needed to progress was a gift from Spain, but Japan held on to their lead over 'La Roja' to keep Hansi Flick's team from advancing to the knockout stages.