A stoppage-time header from Niclas Füllkrug has rescued a 1-1 draw for Germany against Switzerland on Sunday in Frankfurt, ensuring the Euro hosts finish top of Group A.
The Swiss hit the lead early, Dan Ndoye booting in from close range after 28 minutes to stun the home side.
Germany took a series of risks late in the hope of an equaliser and veteran striker Füllkrug delivered, heading home in the second minute of stoppage time.
The result means Switzerland, rather than Germany, face a tougher last 16 assignment, setting up a potential meeting with holders Italy or 2018 World Cup finalists Croatia.
The Germans look set to face second place in England’s Group C, which is currently Denmark.
Heading into the match the hosts were optimistic they had turned the corner after almost a decade of disappointment at major tournaments, with two World Cup group stage exits bookending a Euros last 16 elimination.
Led by an experienced midfield featuring captain Ilkay Gundogan and Toni Kroos, Germany beat both Scotland and Hungary in their first two Euros matches to give the hosts hope of a deep run in the tournament.
The hosts were however caught off guard by Switzerland’s energy and failed to carve out many clear-cut chances against a dogged Swiss defence.
Despite Füllkrug’s late rescue effort, Germany coach Julian Nagelsmann will have plenty to ponder after the stodgy performance.
Despite having already qualified for the last 16, Nagelsmann decided to play the same starting XI for the third straight game.
It was a decision he may regret when defender Jonathan Tah saw yellow, his second in the group stage, meaning he will miss Germany’s first knockout game.
Pushed on by an optimistic and partisan home ground, Germany started brightly, carving out some half-chances after launching long balls over Switzerland’s midfield press.
Robert Andrich looked to have given Germany the lead after 16 minutes when Yann Sommer made a meal of his long-range strike, which bounced past the goalkeeper and into the net.
The goal was however overturned with VAR finding Jamal Musiala had committed a foul in the lead-up.
The Swiss had been on the back foot early but took the lead on the 28-minute mark, taking advantage of some sloppy play from Musiala and Joshua Kimmich.
Musiala lost the ball in his own half, sending Switzerland on the break. Kimmich won but then let go of possession, allowing Remo Freuler to find Ndoye who stuck out a leg and booted the ball into the net.
It was the first time the hosts have trailed this tournament and the goal seemed to rattle Germany, who were increasingly hesitant in closing out the first half.
Germany went on the attack in the second half as Nagelsmann made several offensive changes but the hosts had few clear chances against a Swiss side doggedly protecting their lead.
Man City defender Manuel Akanji stretched out to block Kimmich at point-black range with 20 minutes remaining.
Nagelsmann brought Füllkrug from the bench with 14 minutes remaining and the Borussia Dortmund striker stepped up to the plate, heading in a cross from David Raum to send Germany back to the top of the group.