Alvaro Morata's late goal helped Spain qualify for the 2022 World Cup and consigned Sweden to the play-offs.
Sweden goalkeeper Robin Olsen tipped Dani Olmo's shot on to the crossbar with Morata on hand to tap the ball in after 86 minutes.
Luis Enrique's side needed just a point to top Group B while Sweden needed to win to finish above their opponents.
The result means Spain have qualified for a 12th consecutive World Cup finals.
Sweden will have another chance to reach Qatar in the European play-offs in March.
Spain started the brighter with winger Pablo Sarabia curling an effort narrowly wide from 20 yards in the opening exchanges.
The visitors grew into the match and had a number of chances in the first half with forward Emil Forsberg twice going close to breaking the deadlock.
And Alexander Isak should have put Janne Andersson's side in front when through on goal midway through the second period, but the forward snatched at his chance after capitalising on some lapsed defending.
Spain held on after taking a late lead and keep up their run of reaching every World Cup since 1974.
Latest Stories
-
Photos from DW-JoyNews street debate on ‘galamsey’
21 seconds -
Mimmy Yeboah: Blending heritage with global sophistication, confidence redefined through couture
15 mins -
Akufo-Addo commissions 97-km Tema-Mpakadan railway line
43 mins -
Majority requests recall of Parliament
59 mins -
Kanzlsperger and Professor Quartey support WAFA with medical Donation
1 hour -
Gideon Boako donates 10 industrial sewing machines to Yamfo Technical Institute
1 hour -
‘Golden Boy’ Abdul Karim Razak honored at WAFU-B general assembly
2 hours -
Buipewura Jinapor secures Vice Presidential position in National House of Chiefs with record votes
2 hours -
2024 election: I want results to come out like ‘milk and honey’ – Toobu
2 hours -
Ghana’s Henry Bukari hands over chairmanship of ECOWAS Brown Card Council of Bureaux
2 hours -
Residents of Dome-Kwabenya on edge ahead of December elections
2 hours -
Moffy drops new single ‘Wo’, blending culture and modernity
3 hours -
Don’t bring soldiers to polling stations – Martin Kpebu
3 hours -
Ogyeahohuo Yaw Gyebi II retained as President of National House of Chiefs
3 hours -
Embrace ICT to fit in digital world – Ho NYA boss to youth
4 hours