Toni Kroos’ injury-time winner against Sweden revived defending champions Germany’s hopes of becoming the first side to retain the World Cup since Brazil in 1962.
Ola Toivonen’s deft first-half lob had left Joachim Low’s side facing elimination but Marco Reus, starting in place of Arsenal’s Mesut Ozil, prodded in an equalizer as Germany assumed control after the interval.
The champions then had Jerome Boateng sent off late on for a second yellow card but continued to chase the game knowing a draw left their fate in others’ hands.
And they were rewarded in the final minute of five added on when Kroos tapped a free-kick short to Marco Reus before sweeping the return pass into the top right corner from left of the penalty area.
The magnitude of the moment saw the euphoric German players run to rejoice in front of their own fans while the Sweden players slumped to the floor, some close to tears.
There were also angry exchanges in the technical area with Sweden’s manager Janne Anderson upset by the exuberance of the celebrations in front of him.
The result means all four teams in Group F can still qualify for the next phase, with the outcome to be decided at venues 600 miles apart on Wednesday 27 June when Mexico face Sweden in Ekaterinburg and Germany play South Korea in Kazan.
At half-time it looked as though it was to be a black night for Germany in Sochi, the southernmost venue at the tournament, over 1,000 miles from Moscow, on the coast of the Black Sea.
It seemed perfectly possible that Germany could lose back-to-back games at a finals for the first time since 1958 and become the fourth champions in the past five tournaments to exit at the first-round stage.
But with Low urging his side on from the technical area there was a noticeable increase in tempo following the introduction of Mario Gomez at the interval.
And when Gomez was unable to reach Timo Werner’s cross, Reus followed up to level the score, restore some belief to the rattled Germans and visibly relieve the tension on manager and supporters inside the Fisht Olympic Stadium.