For a short time, just over half an hour including the half-time interval, Germany were on their way out of the World Cup.
For a good deal longer they remained in deep, deep trouble, unable to find a winner, teetering on the brink and vulnerable to a carve-up at the hands of Mexico and Sweden, east of the Urals on Wednesday.
They were down to 10 men, running low on ideas and the Swedes were defending as if lives depended on it when Toni Kroos addressed a free-kick, wide on the German left as the clock ticked into the last minute of stoppage time.
Kroos rolled the ball short to Marco Reus, scorer of the equaliser early in the second half and then whipped a swerving drive through a crowd scene.
It seemed to accelerate as it rose into the far corner. Sweden sank to its knees, exhausted and beaten.
Germany breathed again and launched into jubilant celebrations. They must beat South Korea in Kazan on Wednesday and even then may have to rely on goal difference.
TODAY’S WORLD CUP MATCHES
Saudi Arabia 2pm Egypt
Uruguay 2pm Russia
Iran 6pm Portugal
Spain 6pm Morocco