Striker Kasper Dolberg scored twice either side of the half time break and late goals from Joakim Mæhle and Martin Braithwaite wrapped up the result as Denmark looked the better side throughout.
Wales was limited to half chances by a stout Danish defense, with Gareth Bale coming closest early in the encounter, but his effort just went wide of the post. Harry Wilson received a red card late on for a cynical challenge.
Denmark’s qualification for the quarterfinals comes two weeks after its star midfielder, Christian Eriksen, suffered a cardiac arrest during its game against Finland in the group stages. Eriksen has since been discharged from hospital after undergoing a “successful operation” and having been fitted with an implantable cardioverter defibrillator (ICD).
“It’s completely crazy,” Dolberg told DR afterwards. “I actually don’t know how I feel. This is total madness. It’s surreal. It was here it all started for me, and to play here again in this setting was insane.”
With Danish fans permitted to travel to Amsterdam, the Johan Cruyff Arena was predominately made up of Denmark supporters.
Wales captain Bale offered his country’s well wishes to Eriksen ahead of the game, handing over a Wales shirt with Eriksen’s No. 10 and with the words “Christian, Get Well Soon.”
After some passionate national anthems, the game started with fervor and pace, with both teams exchanging chances in the opening minutes.
Bale’s shot went whizzing past Kasper Schmeichel’s post but it was Denmark that broke the deadlock.
In the 27th minute, Dolberg received the ball, turned and ran at a static Welsh defense before firing past an outstretched Danny Ward.
The goal seemed to spur on Denmark, closing out the first half with heavy pressure chances. But it didn’t have to wait long to double the lead, with Dolberg capitalizing on a poor clearance from Neco Williams to score his second goal of the tournament.
Needing goals to get itself back in the game, Wales pushed forward, only to the benefit of Denmark.
Mæhle and Braithwaite scored from inside the area to make the result more emphatic and qualify Denmark for the quarterfinals.
Wales midfielder Wilson got a late red card for clipping the heels of a Danish attacker.
“It’s not how we wanted the game to go, from our point of view we started very well and then the game changed.” Bale told BBC afterwards.
“We tried to play in the second half but made a mistake to concede which killed the momentum on our side. To finish how we did is disappointed but the boys are frustrated and angry understandably, I’d prefer us to go out that way.”
Denmark will face either Netherlands or Czech Republic in Baku, Azerbaijan, in the quarterfinals.