A late Leon Goretzka goal salvaged a 2-2 draw for Germany against Hungary to set them up with a round of 26 knockout match against England at Wembley.
The Germans were teetering on the brink of another shock tournament exit after Adam Szalai's diving header in the 11th minute had put Hungary in front.
Chelsea's Kai Havertz drew Germany level in the 66th minute, only for Hungary to retake the lead seconds after the restart as Andras Schaefer ran on to a pass and headed in.
Goretzka snatched the crucial equaliser in the 84th minute to send Germany through in second place behind France in Group F on four points.
"We made mistakes but we fought, showed character," said Germany coach Joachim Low. "It was not for the faint-hearted. At the end to come through this group was good and that was the aim.
"What matters is that we are through. Now we play with England and we can look forward to that match. It is an absolute highlight to play at Wembley against England. We will be a different team than tonight, I can promise you that."
Player ratings from the match can be seen in the picture gallery above. To view the next image, click on the arrows or swipe if on a mobile device.