Germany advanced to the quarter-finals of Euro 2012 on Sunday as defender Lars Bender scored his first international goal to seal their 2-1 win over Denmark which put the Danes out.
After Portugal's 2-1 win over Holland in Kharkiv, another three points at Arena Lviv confirmed Germany as Group B winners with three victories while Portugal progress as runners-up from the so-called "Group of Death".
"The match was just as tough as we thought it would be," admitted Germany coach Joachim Loew.
"We lacked the killer instinct in the first-half, which would have made it easier, and then Denmark scored.
"We knew we could have gone out if we had gone behind, so nerves crept in.
"We showed maturity in the second-half, but we can still improve."
The Germans will now play Friday's quarter-final against Group A runners-up Greece in Gdansk, their Euro 2012 base, while Portugal will play the Group A winners the Czech Republic in Warsaw on Thursday.
"We have to be disappointed, but I am not disappointed with the team," said Denmark coach Morten Olsen.
"It was a fantastic performance and we have played against one of the world's elite, but unfortunately we paid the price for our carelessness."
Lukas Podolski, who was making his 100th appearance for Germany, celebrated his century with the opening goal on 19 minutes which was cancelled out by a Michael Krohn-Dehli just five minutes later before Bender's late winner.
"Independent of the goal, that was my first start (for Germany), so it was something special," beamed Bender.
"We were trying to get that second goal, I just saw the goal in front of me and it was a bit lucky.
"I am not used to being in that position, but it felt good to be there."
Having made his debut in the 2-2 friendly draw with Poland last September, the 23-year-old Bender was making only his ninth appearance for Germany, while twin brother Sven, who plays for Borussia Dortmund, was cut from the squad.
Both coaches made only essential changes to their start line-ups.
Loew opted for Bayer Leverkusen's Bender at right-back for Bayern Munich's Jerome Boateng, who was suspended after picking up a yellow card in their 2-1 win over Holland last Wednesday.
Likewise, Olsen brought Jakob Poulsen into the midfield for veteran forward Dennis Rommedahl, who damaged his hamstring in their 3-2 defeat to Portugal.
The Germans started at pace and got the break through when Mueller fired his pass across the Denmark goal and Mario Gomez let the ball roll for man-of-the-match Podolski to drill his shot home on for his 44th international goal.
It was 1-1 at the break, but midfielder Jakub Poulson, in for hamstring injury-victim Rommedahl, clipped the post with his shot on 51 minutes.
The game's tempo dropped in the second-half with Germany's midfield star Mesut Ozil looking flat as the Danish defenders constantly thwarted the Germans.
Podolski was brought off with 25 minutes left as Leverkusen's Andre Schuerrle was given his chance and he soon tested Andersen with a shot.
With ten minutes to go, Germany counter-attacked at pace. Ozil squared for the grateful Bender and the right-back calmly slotted past Andersen to seal victory.