Sweden ended up hanging on grimly to a 2-1 win against close neighbours Denmark in a game they looked to have won comfortably but still travel to Copenhagen on Tuesday as the narrow favourites in this play-off to reach Euro 2016.
A brilliant goal just before half-time from Emil Forsberg and a second-half penalty from 34-year-old captain Zlatan Ibrahimovic looked to have settled the tie but Sweden failed to capitalise on a tentative Danish display and were punished in the 81st minute when Nicolai Jørgensen swept in at the far post from a corner as the Swedish defence dozed.
After a minute's silence to honour the victims of the Paris attacks, Denmark, the 1992 champions, dominated early possession but it was Sweden who had the best opening.
It fell to Panathinaikos striker Marcus Berg in the 18th minute but his low, left-foot shot was well saved by Kasper Schmeichel.
Berg went wide of the target on the half-hour mark after being released by a fine ball from Ibrahimovic who was furious that he did not receive a return pass. Ibrahimovic was becoming increasingly influential as the game progressed and just missed out after a smart turn and drive scraped the post.
At the other end, Nicklas Bendtner squandered Denmark's best chance, missing from just six yards out after an incisive pass from Christian Eriksen.
The Danes were made to pay when Sweden grabbed the lead on the stroke of half-time.
A backheel from Jimmy Durmaz allowed Mikael Lustig to sprint away down the right flank and his pass reached Forsberg at speed and the Leipzig winger buried a first-time shot into the corner past Schmeichel.
The Denmark goalkeeper rescued his team just before the half-time whistle with a diving save to deny Ibrahimovic's powerhouse free-kick from just outside the box.
Ibrahimovic made it 2-0 five minutes into the second period, converting a penalty after Thomas Kahlenburg had clumsily tripped Forsberg. It was the Paris Saint Germain star's first goal against the Danes in seven matches.
But with 10 minutes left, substitute Jørgensen latched onto a Poulsen flick-on from an Eriksen corner to keep alive Denmark's hopes of making the finals in France next summer.