ECSTATIC: Denmark's Kasper Schmeichel celebrates with Martin Braithwaite and teammates after victory against the Republic of Ireland.
Ireland needed to beat Denmark in Dublin to clinch qualification for next year's 24-team European Championship finals, but Matt Doherty's late header was only enough to earn Mick McCarthy's men a 1-1 draw at the Aviva Stadium.
A closely-fought contest, low on technical quality, swung the visitors' way when the unmarked Martin Braithwaite stuck out a boot to divert a Henrik Dalsgaard cross into the net on 73 minutes.
However, Ireland scored a late equaliser to draw 1-1 in Copenhagen in June and they repeated the feat here as Wolverhampton Wanderers right-back Doherty headed in an Enda Stevens cross with five minutes left.
Needing to win, the home side then threw everything at their opponents in the dying moments, but Denmark held on to clinch second place in Group D behind Switzerland.
"We had opportunities but I am not going to criticise the lads," McCarthy told Sky Sports.
"They have been brilliant. We lost one game out of eight. I am very proud of them. We can beat anyone in the play-offs."
The Danes, European champions in 1992, can now look forward to playing at home during the finals, with Copenhagen one of the 12 host cities chosen for the tournament.
Switzerland secured top spot with a 6-1 away win against minnows Gibraltar as Cedric Itten scored twice. Skipper and Arsenal outcast Granit Xhaka netted their final goal.
Italy had already wrapped up qualification from Group J but they saved their best for last, making it 10 wins from 10 by hammering Armenia 9-1 in Palermo with seven different scorers.
Serie A top scorer Ciro Immobile and Nicolo Zaniolo both scored braces, while Nicolo Barella and Alessio Romagnoli found the net before Chelsea midfielder Jorginho converted a penalty.
Riccardo Orsolini came off the bench to score on his Italy debut and Federico Chiesa finished off the scoring after Edgar Babayan had pulled one back for Armenia.
It was an 11th straight win in all for Mancini's side, with Italy scoring nine times in a game for the first time since beating the USA 9-0 at the London Olympics in 1948.
"We had the right approach to the game and you don't score nine goals by chance," Mancini purred.
"We need to improve various aspects of the game but for me it will be really difficult to leave some people at home when I select the squad for the finals. They would all deserve to be there."
Having wrapped up a historic first qualification for a major tournament three days earlier, Finland lost 2-1 to Greece in Athens despite Norwich City striker Teemu Pukki giving them a first-half lead with his 10th goal in eight international games.
Bosnia and Herzegovina finish fourth in the group despite a 3-0 win in Liechtenstein, but they will have another chance to qualify via the play-offs next March.
Meanwhile, Group F winners Spain rounded out their qualifying campaign with a 5-0 destruction of Romania at a barely half-full Metropolitano Stadium in Madrid.
Gerard Moreno scored twice after Napoli midfielder Fabian Ruiz opened the scoring. Adrian Rus put through his own net in first-half stoppage time and Real Sociedad striker Mikel Oyarzabal wrapped up the win amid reports the match was Robert Moreno's last as coach.
Having already qualified as runners-up in the same group, Sweden defeated the Faroe Islands 3-0, while Norway, who go into the play-offs, won 2-1 in Malta.
The final automatic qualifying berth will be decided on Tuesday as Wales host Hungary with the winner going through from Group E, while a draw in Cardiff could allow Slovakia to pip both of them by beating Azerbaijan.