Germany have booked a last-16 meeting with England after a topsy-turvy 2-2 draw with Hungary in Munich.
Hungary went ahead twice on the night but ultimately succumbed despite a gallant effort against the favoured Germans.
Adam Szalai put the visitors ahead with an 11th minute goal which stunned Die Mannschaft.
A delightful cross from Roland Sallai was sent into the German box, with Szalai splitting his run in between centre-backs Matias Ginter and Mats Hummels perfectly to meet the cross and send a diving header flying into the bottom corner past an outstretched Neuer.
Germany wanted to respond straight away, and they almost did so after a brilliant jinky run from Chelsea attacker Kai Havertz, but his teasing square ball across the six-yard box was missed by a number of his teammates.
Mats Hummels then clattered the bar with a terrific header, and moments later it was Ginter who had a chance, but his tame shot from close range was aimed straight at Peter Gulasci.
Hungary celebrate their surprise opener
As they did against France, Hungary settled into a stoic low block and never failed to threaten on the counter attack.
Despite having 70 per cent of possession in the first-half, Germany played without the zest and spirit which saw them trample Portugal.
In what was a rain soaked Allianz Arena, the second-half started in much the same fashion as Germany sought to penetrate the Hungary defence.
It took 20 minutes but Germany eventually made the breakthrough, thanks largely to a poor decision from Hungary goalkeeper Gulasci.
Joshua Kimmich whipped in a free kick into the box which Gulasci rushed to claim, but the RB Leipzig star flapped at the ball, allowing Mats Hummels to head across the goal for Kai Havertz to score from point blank range.
But before you could blink, Hungary were back in front.
A golden rule of football is emphasising concentration directly after you score, it is those few minutes afterwards when the opposition is most likely to respond.
The Germans clearly forgot that missive as Hungary pounced directly from the kick-off. A hooked through ball from Szalai allowed Schafer to surge through the German defence and head past Neuer.
It was a moment which caught Germany manager Joachim Low in a state of shock as it looked as though his 15-year tenure would end at the group stage.
With 80 minutes on the clock, Toni Kroos had a great chance after a neat one-two with Robin Gosens but fired just wide of the far post.
Elation for Germany and heartbreak for Hungary
It didn't matter however as Leon Goretzka became Germany's saviour with a late strike.
After a deflection in the box, the ball fell perfectly to the Bayern Munich midfielder who made no mistake steering his shot past Gulasci.
On a night which will go down in European Championship history, Germany avoided an embarrassing group stage exit and will now play England in the round of 16 after finishing second in Group F.
The old rivals will face off at Wembley next Tuesday.
Hungary can certainly hold their heads up high after getting within six minutes of qualifying out of the 'Group of Death'.
EURO 2020 - GROUP STAGE
Germany - 2 (Havertz 66', Goretzka 84')
Hungary - 2 (Szalai 11', Schafer 68')
Allianz Arena, Munich
Man of the Match: Mats Hummels
Need a VPN? Or seeking to switch? Then support Tribal Football by clicking here to sign up with our official partners NordVPN. Not only will you receive the best VPN experience, but also great discounts by signing up via Tribal Football. Thanks for your support!