Lars Bender scored the winner 10 minutes from time as Germany took their place in the quarter-finals of Euro 2012 as convincing winners of Group B.
The 23-year-old Bayer Leverkusen player poked in late on to end Denmark's dream of repeating their heroics of 1992.
Germany had taken a 19th-minute lead through Lukas Podolski, only for Michael Krohn-Dehli to head in six minutes later and give Denmark hope.
Germany, who qualify with a 100% record, play Greece in the last eight.
For much of this game, this was a dominant display by Germany, inspired by Sami Khedira's midfield generalship, Thomas Mueller's prodigious work on the wings and a workrate and ambition that glowed throughout the team.
The long journeys from Germany's team base in Poland to Ukraine have not gone down well with the squad but having topped the group with victory in Lviv, they have earned a quarter-final in Gdansk, the city where they are based.
The last time Denmark and Germany met in a competitive fixture had been memorable for very different reasons. The final of the 1992 European Championship saw the Danes, late replacements for the banned Yugoslavia, beat the Germans in the final to complete one of the most surprising tournament victories in history.
Denmark have struggled to escape the shadow of that victory ever since but with the sublime young talents such as Christian Eriksen in the side there was a sense of optimism that 20 years on the seemingly impossible might just be possible all over again.
Germany were in no mood for a repeat, however. For long periods of this match Joachim Loew's side were untouchable in possession with Mueller and Bastian Schweinsteiger dictating from midfield.
Whether breaking past an opponent from wide on the right flank, or erupting with dramatic suddenness through the middle of a defence, Mueller's early runs were an exhilarating blend of grace and devastation.
The Bayern Munich midfielder was a constant danger, but twice in the early moments he spurned good chances, failing to make clean contact when the ball broke to him six yards from goal and shooting narrowly over with the goal at his mercy.
It was no surprise when Mueller created the opening goal for Germany, exchanging passes with Mesut Ozil, before cutting the ball back across the penalty area from the right where Podolski thumped it ruthlessly beyond Denmark goalkeeper Stephan Andersen.
It was the perfect way to celebrate becoming the youngest European player, at the age of 27, to reach 100 caps.
Denmark were bystanders for much of the opening period, unable to prevent or disrupt the German passing carousel and relying on intermittent long-range attacks. But what became clear quite quickly was their dominance at set-pieces.
Arsenal striker Nicklas Bendtner had won an early header in the penalty area and when he rose again to meet Lars Jacobsen's 23rd-minute corner, Germany were found wanting. The Dane rose majestically to direct the ball back across goal, where Krohn-Dehli headed it decisively beyond Germany goalkeeper Manuel Neuer.
But while Denmark visibly grew in confidence after the goal, Germany continued to dominate. Mario Gomez was always on hand to provide the German attack with a focal point and might have done better on two occasions before half-time when the ball broke kindly to him.
Khedira was also guilty of wastefulness, exchanging passes with Gomez only to prod the ball wide with the outside of his right foot when the ball broke to him.
Denmark were, however, unbowed. Starved of possession and chasing shadows, the clenched fist of their coach Morten Olsen at half-time said it all.
It had been a gesture of unexpected defiance in the face of German domination and his time almost responded.
Denmark looked a different side early in the second half and should have snatched an unlikely lead when Bendtner collected Simon Poulsen's clever pass in the penalty box before laying the ball off to Jakob Poulsen, who skimmed the outside of the post with his low shot.
The fluency Germany had found for long periods was being disrupted by a Denmark side that tackled, battled and denied space, their uncomplicated, direct approach putting their more celebrated opponents under serious duress.
The introduction of Bayern Leverkusen striker Andre Schuerrle appeared to help Germany regain their dynamism, however. The 21-year-old almost made an immediate impact, gathering Khedira's delightfully-weighted pass before directing a fierce, low shot across goal which Andersen did well to push to safety.
Germany by the numbers
- Lukas Podolski has become the youngest European player to reach 100 caps.
- Germany were playing with their youngest line-up in a European Championship match with an average of 25 years and 107 days.
- This is the first time Germany have completed a European Championship group stage with a 100% record.
- Source: Opta Sports
Bendtner was unfortunate moments later when he stretched to lift a shot high into Neuer's hands, while Germany defender Holger Badstuber pulled at his shirt.
But with Denmark tiring, Bender broke forward covering 60 yards to take advantage of Simon Poulsen's slip and roll the ball beyond Andersen. It was the youngster's first goal for Germany on his first start for his country and the moment that decided the outcome of Group B.
Agger rose high above Badstuber to head over as Denmark continued to push but the chance had gone and the dream was over.
For Germany, it remains very much alive.
Sorry, we were unable to load match stats, please try again.
CommentsJump to comments pagination
Comment number 34.sambuczynskyj
18th June 2012 - 17:31
Comment number 33.jgore
18th June 2012 - 17:18
Comment number 32.Dickster1981
18th June 2012 - 15:43
Comment number 31.stevdk
18th June 2012 - 14:27
Comment number 30.RememberScarborough
18th June 2012 - 14:25