Denmark replaced Wales at the top of Group I after edging their Euro 2025 Under-21 Championship qualifier at Rodney Parade in Newport.
The visitors led early when Tobias Bech fired low past Ed Beach, before Luke Harris, Charlie Savage and Joe Taylor went close for Wales.
Oliver Nielsen headed in a late corner to double the lead after the break.
Cian Ashford poked home a last-gasp consolation after Filip Jorgensen parried Rubin Colwill's free-kick.
Denmark now lead the group on goal difference but have played a game less than Wales, with both on eight points.
Iceland, who Wales beat 1-0 last Thursday in Newport, are third on six points but have two games in hand on Matthew Jones' side.
The nine group winners and the three best runners-up qualify directly for the final tournament, with the six other runners-up contesting play-offs for the final three places.
Wales' next qualifier is next year on 22 March at home to Lithuania, before travelling to Iceland on 10 September and then completing their group campaign at home to the Czech Republic on 11 October.