Bayt Stadium, Qatar: Despite defeating Costa Rica 4-2 late on Thursday night, Germany were eliminated from the World Cup at the group stage for the second time in a row.
The four-time world champions knew only victory at Qatar's Al Bayt Stadium — and Japan's failure to upset Spain in Group E's other fixture — would keep their aspirations alive after a shocking loss to Japan and a scrappy draw against Spain.
But Japan did upset Spain.
Though Chelsea's Kai Havertz scored a quick double to help Germany come back and win, Hansi Flick's team was eliminated after Japan defeated Spain 2-1.
Japan and Spain secured their places in the next round as Costa Rica came last in the group.
After barely 10 minutes, Serge Gnabry caused the back of the net to tremble, giving Germany's night a promising start.
Germany's left wing was the source of the goal, and Gnabry skillfully guided David Raum's cross into the far corner.
Leon Goretzka came close to scoring at the back post, but Keylor Navas denied him with a diving header. The excellent Jamal Musiala then expertly tip-toed into the Costa Rica area, but his shot was wide.
Germany had Manuel Neuer, who was playing in his 19th World Cup game to become the goalkeeper with the most appearances, despite being in perfect control.