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
-
Kuami Eugene shows leadership; mobilises fellow artistes for peace song
30 mins -
The JOY Prime Made in Ghana Fair: Why not miss it!
1 hour -
GPL 2024/25: Struggling Asante Kotoko aim to bounce back against high-flying Nations FC
1 hour -
GES Deputy D-G admonishes students to uphold integrity and teamwork
2 hours -
Election 2024: Osabarima Dr Owusu Beyeeman advocates for peace
2 hours -
Fashion at Joy Prime Made in Ghana Fair
4 hours -
Alan Kyerematen wanted me to be his running mate – Okyeame Kwame
4 hours -
AFCON 2025Q: Otto Addo calls up Jerry Afriyie, two others for Niger clash
6 hours -
Vacant Seats: Supreme Court failed to strengthen Ghana’s democracy – NDC’s Beatrice Annan
6 hours -
Coop Kee makes bold statement with ‘Ohemaa’
6 hours -
Judiciary not a rubber stamp for Jubilee House decisions – Atta Akyea asserts
7 hours -
Judiciary being manipulated by politicians – Franklin Cudjoe claims
7 hours -
NPP slams ‘unwarranted and disgraceful’ attacks on Kufuor
7 hours -
Election 2024: Dampare cautions public against electoral misconduct
7 hours -
Mahama: Voting for Bawumia is endorsing mismanagement
7 hours