Match ends, Wales 1, Denmark 2.
Wales missed out on promotion to the Nations League's top tier as they were beaten at home by Denmark, whose victory makes them Group B4 winners and guarantees them at least a play-off to qualify for Euro 2020.
An attack-minded Wales side had several chances to take the lead but their defensive vulnerability was exposed shortly before half-time as they were expertly picked off by a Danish counter-attack, finished clinically by Nicolai Jorgensen.
Ryan Giggs' young team pushed forward with increasing desperation in the second half but, for all their endeavour, they were the recipients of a lesson in game management from their more seasoned and savvy opponents.
Gareth Bale was inches away from equalising when Kasper Schmeichel brilliantly saved his free-kick and with two minutes left, Martin Braithwaite struck a fine second goal for the Danes.
Less than a minute later, Bale rounded Schmeichel and finished into an empty net to give Wales hope of an improbable late revival - but the hosts' onslaught in the closing stages was in vain.
It was a disappointing note on which to end Wales' inaugural Nations League campaign, which had started so promisingly with September's 4-1 demolition of the Republic of Ireland.
But that result, as well as last month's 1-0 triumph in Dublin, was put in perspective by a second defeat against a thoroughly well drilled Danish side.
This was the most important match yet of Giggs' burgeoning tenure, and his response was to name an extremely attacking, adventurous line-up.
Bale and Aaron Ramsey returned after missing last month's win in the Republic of Ireland, though Giggs still kept three of his fledgling attacking talents - David Brooks, Tyler Roberts and Tom Lawrence - in a side seemingly designed with defence a mere afterthought.
It was a risky approach, evident inside three minutes as Christian Eriksen - who scored both goals when Denmark beat Wales in September - was given too much space before firing a 20-yard shot narrowly over the bar.
Undeterred by that warning sign, Wales began to wrestle control of the tie and poured forward in search of the opening goal.
Bale was the first to threaten with a curling effort saved by Schmeichel, before James Chester headed a glorious opportunity wide from Brooks' cross.
Brooks was at the heart of almost every Welsh attack, reproducing his sparkling club form with Bournemouth as he glided across the pitch and looked to unpick the Danish defence.
But it was another forward surge from the hosts which led to their undoing.
Denmark pinched possession near their own penalty area and broke at pace, Thomas Delaney then spread the ball to the right wing, where Yussuf Poulsen's perfectly weighted pass allowed Jorgensen to slot the ball between Wayne Hennessey's legs.
The second half followed a similar pattern to the first, with Wales the aggressors and creating more chances - only to fall foul to another sucker punch.
This time it was Middlesbrough's Braithwaite, allowing the ball to bounce before unleashing a swerving effort into the top corner to seal victory, despite Bale's swift response.
"I'm proud of the lads because they kept going to the end and excited me and excited the crowd," said Giggs.
"We need to learn the other side - the discipline that Denmark are so good at.
"I've enjoyed the Nations League. They've been good games. It's gone right to the last game for us where we could have won it."
Nations League proves its worth
Wales will now remain in the second tier of the Nations League, and this encounter illustrated the value of the new competition.
It had initially caused confusion for those trying to decipher its structural intricacies, but the equation was a simple one for Wales on this occasion.
Win and promotion to the top tier would be theirs, along with the guarantee of a play-off to qualify for Euro 2020, should they fail to reach the tournament during the regular qualifying process.
Lose, as was their fate, and it was Denmark who claimed those prizes.
This was the kind of high-stakes scenario Uefa had hoped for when European football's governing body devised the Nations League, which was designed in part to replace the many friendly matches in the international calendar - considered by many to be meaningless.
The rewards on offer made for a wholehearted encounter at Cardiff City Stadium, with both sides as committed as they would have been for a major tournament fixture.
Whereas friendly matches of the past had little or no significance, Denmark's jubilant celebrations and Wales' dejection demonstrated how the Nations League has been a shot in the arm for international football.
Man of the Match - David Brooks (Wales)
Wales v Denmark - the stats
- Wales have now lost two of their last three competitive matches at the Cardiff City Stadium (W1); they had only suffered two defeats in their previous 14 such games at the ground prior to this.
- Wales have lost back-to-back home games in all competitions for the first time since September 2012, when they lost three in succession.
- Wales have conceded as many goals in their last four international games (eight) as they had in their previous 13 combined.
- Gareth Bale has been directly involved in seven goals in his five appearances for Wales in 2018 (five goals, two assists).
- There were just 84 seconds between Martin Braithwaite putting Denmark 2-0 ahead and Gareth Bale pulling one back for Wales.
- Nicolai Jørgensen's goal was his first for Denmark in over a year since he netted in a World Cup qualifying match against Poland in September 2018, 441 days ago.
- 5ChesterSubstituted forAmpaduat 50'minutesBooked at 86mins
- 6WilliamsBooked at 87mins
- 4DummettBooked at 38minsSubstituted forGunterat 39'minutes
- 17LawrenceBooked at 77mins
- 22RobertsSubstituted forWilsonat 68'minutes
- 1SchmeichelBooked at 90mins
- 14DalsgaardBooked at 51mins
- 13M JorgensenBooked at 87mins
- 17Stryger Larsen
- 19SchöneSubstituted forLeragerat 79'minutes
- 8DelaneyBooked at 82mins
- 9N JørgensenSubstituted forDolbergat 70'minutesBooked at 85mins
- Ivan Kruzliak
- Shots on Target
Second Half ends, Wales 1, Denmark 2.
Corner, Denmark. Conceded by Joe Allen.
Kasper Schmeichel (Denmark) is shown the yellow card.
Foul by Tom Lawrence (Wales).
Christian Eriksen (Denmark) wins a free kick in the defensive half.
Gareth Bale (Wales) wins a free kick in the attacking half.
Foul by Henrik Dalsgaard (Denmark).
Aaron Ramsey (Wales) wins a free kick in the defensive half.
Foul by Yussuf Poulsen (Denmark).
Attempt saved. Gareth Bale (Wales) left footed shot from the centre of the box is saved in the bottom left corner. Assisted by Tom Lawrence with a headed pass.
Goal! Wales 1, Denmark 2. Gareth Bale (Wales) left footed shot from the centre of the box to the centre of the goal. Assisted by Ashley Williams with a through ball.
Goal! Wales 0, Denmark 2. Martin Braithwaite (Denmark) right footed shot from the centre of the box to the top right corner. Assisted by Henrik Dalsgaard.
Zanka (Denmark) is shown the yellow card.
Ashley Williams (Wales) is shown the yellow card.
Ethan Ampadu (Wales) is shown the yellow card for a bad foul.
Foul by Ethan Ampadu (Wales).
Kasper Dolberg (Denmark) wins a free kick in the defensive half.
Kasper Dolberg (Denmark) is shown the yellow card for a bad foul.
Ethan Ampadu (Wales) wins a free kick on the right wing.