Forward Kasper Dolberg scored twice on either side of the half-time break and late goals from Joakim Mæhle and Martin Braithwaite concluded the result as Denmark looked on the better side throughout.
Wales were limited to half the chances by a solid Danish defense, Gareth Bale coming close earlier in the game, but his effort just missed the post. Harry Wilson received a late red card for a cynical challenge.
Denmark’s qualification for the quarter-finals comes two weeks after star midfielder Christian Eriksen suffered cardiac arrest during his game against Finland in the group stage. Eriksen has since been released from hospital after undergoing “successful surgery” and being fitted with an automatic implantable defibrillator (ICD).
“It’s completely crazy,” Dolberg told DR afterward. “Actually, I don’t know how I feel. It’s total madness. It’s surreal. This is where it all started for me, and to play here again in this setting was insane. “
With Danish fans allowed to travel to Amsterdam, the Johan Cruyff Arena was mainly made up of Danish supporters.
After some passionate national anthems, the match started with fervor and rhythm, with the two teams trading their chances in the opening minutes.
Bale’s shot rushed past Kasper Schmeichel’s post, but it was Denmark who broke the deadlock.
In the 27th minute, Dolberg received the ball, turned and ran towards a static Welsh defense before shooting past a tense Danny Ward.
The goal seemed to boost Denmark, ending the first half with a good chance of pressure. But it didn’t take long to double the lead, with Dolberg taking advantage of a poor clearance from Neco Williams to score his second goal of the tournament.
Needing goals to get back into the game, Wales advanced, only to the benefit of Denmark.
Mæhle and Braithwaite scored from inside the box to make the result more categorical and qualify Denmark for the quarter-finals.
Visit CNN.com/sport for more news, features and videos
Wales midfielder Wilson received a late red card for cutting the heels of a Danish striker.
“That’s not how we wanted the game to go, from our point of view we started really well and then the game changed. Bale told the BBC afterwards.
“We tried to play in the second half but we made a mistake in conceding which killed the momentum on our side. In the end like we did, it’s disappointed but the boys are frustrated and angry, it’s understandable, I would rather we went out that way. ”
Denmark will face the Netherlands or the Czech Republic in Baku, Azerbaijan, in the quarter-finals.