Joachim Low's side, who trailed at half-time against Sweden, pulled level just after the break through Marco Reus, but for much of the second half of the match Sweden's defence looked unlikely to surrender a second goal.
With Mexico having already beaten the Germans and Sweden sitting on three points coming in, anything other than a win would have been near disastrous for Low's men, leaving their hopes of advancing to the last 16 hanging by the thinnest of threads.
But Toni Kroos came up with a moment of pure magic, and suddenly things aren't looking so bad after all.
In the fifth minute of stoppage time the Germans earned a free-kick down the left, just outside the penalty area, and the Swedish back line that had fought so hard to hang onto their point were left in a precarious spot.
Despite the tight angle, Kroos took on the job, touching the ball to Reus to give himself a slightly better look at goal before bending a perfect strike around the goalkeeper and into the net.
The goal from Kroos was the latest ever scored by Germany in regular time in the World Cup finals, and it may well have changed the very nature of this competition moving forward.
95 - Toni Kroos' strike (94:42) was Germany's latest ever World Cup goal scored during regulation time (excluding extra time). Poise. #GERSWE #GER #WorldCup pic.twitter.com/n6yomGJSAx — OptaJoe (@OptaJoe) June 23, 2018
The defending champions have gone from the brink of elimination to very much back in the running.