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
-
Bawumia commissions 124 housing units for victims of Appiatse disaster
10 seconds -
Stonebwoy’s The Livingstone Foundation surprises talented autistic boy with gifts
5 mins -
NPP should’ve referred Kingsley Nyarko’s bribery allegation to the police – Inusah Fuseini
14 mins -
Police pursue gunmen for killing 2 off-duty officers at Trasacco
56 mins -
Bayer Leverkusen beat Roma to win semifinal first leg
58 mins -
Aston Villa face tough task after 2-4 defeat to Olympiacos
1 hour -
NGO empowers women and girls with disabilities
1 hour -
Guinness World Records: Nigerian woman paints nails for three days
1 hour -
Season 2 of ‘I’m in Love with Boma Ye’ returns this May on Joy Prime
1 hour -
Akufo-Addo’s disrespect of chiefs won’t be tolerated – Haruna Iddrisu
1 hour -
Chalobah and Jackson score as Chelsea defeat Tottenham
1 hour -
NPP praises Police, EC for successful Ejisu by-election
2 hours -
2024 Ramadan Cup: Bawumia donates 20,000 to four teams as Ashaiman lifts trophy
2 hours -
PMI Ghana Chapter members tour Kasoa BSP Project
2 hours -
Child Rights International pledges support for toddler mauled by dog
2 hours