Substitute Leon Goretzka scored a last-gasp equaliser and secured Germany a spot in the last 16 following a 2-2 draw with resilient Hungary at the Football Arena Munich here.
The Germans took the reins from the start and were able to keep Hungary's defence busy in the opening period on Wednesday.
Hungary's defence was able to soak up Germany's pressure and frustrated the hosts with the opener against the run of the game as Adam Szalai headed home a long ball into the penalty area with 11 minutes into the match, reports Xinhua.
Germany remained in control but failed to create dangerous chances in the final third against Hungary's bulwark.
With 21 minutes gone, Germany eventually reaped their first promising chance after Mats Hummels headed into the crossbar from close range. It remained Germany's only noteworthy chance against the deep-defending visitors.
After the break, Germany took over again but Kai Havertz's effort on target was an easy task for Hungary goalkeeper Peter Gulacsi in the 52nd minute.
More From This Section
As soon as Hungary approached Germany's goal, they caused trouble as Szalai rattled the woodwork following a free-kick at the hour mark.
Germany were finally able to level the scores with great assistance of Gulacsi, who underestimated a sweeping free-kick from Toni Kross, allowing Kai Havertz to head home into the open goal in the 66th minute.
Hungary's resistance wasn't broken yet as Marco Rossi's men restored their one-goal lead with their next attack after Szalai's assist found Andras Schafer, whose header beat the onrushing Germany custodian Manuel Neuer two minutes later.
Germany head coach Joachim Low reacted and fielded Thomas Muller, Timo Werner, Jamal Musiala and Kevin Volland. Low's substitution paid off in the dying minutes of the game as Musiala's build-up and Werner's blocked shot landed in the path of Goretzka, who made no mistake and scored the crucial equaliser after slotting the rebound past Gulacsi.
With the draw, Germany clinched their berth in the round of 16, while Hungary crashed out of the tournament.
"I'm very proud that we performed the way we did, but I'm disappointed at falling short. We've played ever so well. We can't complain; we're proud of how we've played," Hungary midfielder Roland Sallai said.
"We are of course relieved. We fell behind twice and had to run behind a deficit. That is of course not easy against a deep-defending opponent. It was a thriller until the final whistle," Germany captain and goalkeeper Manuel Neuer said.
France (5 points) finished on top of Group F followed by Germany, Portugal (both 4 points) and Hungary (2 points).
--IANS
akm/in