Denmark's victory condemns Ireland to third seeding
Wales 1 Denmark 2
Denmark overcame Wales in a passionate encounter in Cardiff to clinch promotion to the top tier of the Nations League and in the process condemned Ireland to bottom place in the group, which means a third seeding for the Euro 2020 draw.
Nicolai Jorgensen gave Denmark a half-time lead and Martin Braithwaite's superb volley two minutes from time doubled their advantage to seemingly end Welsh hopes.
But Gareth Bale's instant response, sliding home his 31st international goal after rounding Denmark goalkeeper Kasper Schmeichel, had the visitors hanging on at the end.
Wales were not short of endeavour against opponents who had reached the last 16 of the World Cup in the summer, but even with the fit-again Bale in their ranks they often lacked the craft to worry the streetwise Danes.
Taking out the 3-0 defeat to Slovakia in September, when an amateur team played because of a row over the squad's commercial rights, Denmark have now conceded only twice in 12 games.
It is that defensive durability on which Denmark build their game and why it is they, and not Wales, who will be joining the elite of European football.
Denmark are also guaranteed a play-off to qualify for Euro 2020, should they fail to reach the tournament during the regular qualifying process, while a youthful Wales side should be better for this experience when the qualifiers start in March.
Bale returned after sitting out Wales's October action and Denmark's own talisman Christian Eriksen was also back after missing the last two games through injury.
The Tottenham playmaker had scored both goals when Denmark beat Wales 2-0 in Aarhus in September and Denmark attempted to get their creative spark on the ball at every opportunity.
Aaron Ramsey was deployed in a deeper role than he is accustomed for Wales and part of his brief was to monitor Eriksen's forays forward.
The signs were ominous for Wales as Eriksen strode forward as early as the third minute to send a 25-yard drive whistling over the crossbar.
But in what was proving a lively opening Wales settled and went close to scoring twice inside a minute.
Paul Dummett, starting a competitive game for the first time nearly four-and-a-half years after making his debut, set up Bale for a 25-yard attempt that Schmeichel batted aside.
Wales had an even better chance moments later when Ramsey's back-heel allowed David Brooks to cross and James Chester headed wide from six yards out.
But Denmark were in the ascendancy before Dummett's departure to injury allowed Chris Gunter to equal Neville Southall's record of 92 caps for Wales.
Thomas Delaney had failed to connect with Martin Braithwaite's inviting ball before Wales were exposed by a lightning counter-attack.
Yussuf Poulsen raced onto Delaney's pass for Jorgensen to slot the ball through the legs of Hennessey.
Bale almost equalised when his free-kick was brilliantly clawed away by Kasper Schmeichel and tempers threatened to boil over in the final moments after some poor challenges.
There was even more late drama as Braithwaite and Bale struck inside a minute, but Denmark held on to clinch promotion and leave Wales in second ahead of the relegated Ireland to compound a disappointing few days for Martin O'Neill.