Sweden held on to secure their place at Euro 2016 after Denmark fought back to a 2-2 draw in Copenhagen, but went out 4-3 on aggregate.
The visitors, who were 2-1 ahead from the first leg in Stockholm, looked to be in cruise control following a neat first-half finish from Zlatan Ibrahimovic.
The Paris Saint-Germain forward added another on 76 minutes when he blasted a free-kick into the top-right corner.
However, despite the tie being seemingly beyond them and rarely threatening during the match, Denmark – who had finished behind Portugal and Albania in Group I – produced a late rally with goals from Yussuf Poulsen (81) and Yannik Vestergaard, in stoppage time, but it was Sweden who progressed.
Ukraine will complete the line-up in France next summer after they drew 1-1 with Slovenia in Maribor, which was enough for a 3-1 aggregate victory.
Slovenia, who were in England’s qualifying group, got off to the perfect start at the Stadion Ljudski when captain Bostjan Cesar headed in from close range on 11 minutes after Valter Birsa’s cross was not cleared.
However, the home side, trailing 2-0 from the first leg in Lviv, could not find a crucial second goal and ended the match with 10 men following a straight red card for defender Miso Brecko after a foul on Yevhen Konoplyanka.
Deep into stoppage time, Andriy Yarmolenko equalised from close range as Ukraine put an end to their play-off misery, having lost out for a place at the 2014 World Cup to France.