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.
- 9Paez GaviriaSubstituted forRodriat 90′minutes
- 10SolerSubstituted forMerinoat 73′minutes
- 22SarabiaSubstituted forMorataat 59′minutes
- 11de TomásSubstituted forRodrigoat 60′minutes
- 21OlmoSubstituted forMéndezat 90′minutesBooked at 90mins
- 1de Gea
- 2KrafthBooked at 77minsSubstituted forOlssonat 85′minutes
- 10ForsbergSubstituted forSvanbergat 63′minutes
- 21KulusevskiSubstituted forQuaisonat 64′minutes
- 9IsakSubstituted forIbrahimovicat 73′minutesBooked at 90mins
- Dr. Felix Brych
Match ends, Spain 1, Sweden 0.
Second Half ends, Spain 1, Sweden 0.
Attempt missed. Zlatan Ibrahimovic (Sweden) with an attempt from the centre of the box misses to the right. Assisted by Mattias Svanberg with a cross following a corner.
Corner, Sweden. Conceded by Rodrigo.
Zlatan Ibrahimovic (Sweden) is shown the yellow card.
Corner, Sweden. Conceded by Aymeric Laporte.
Brais Méndez (Spain) is shown the yellow card for a bad foul.
Foul by Brais Méndez (Spain).
Mattias Svanberg (Sweden) wins a free kick in the attacking half.
Attempt blocked. Zlatan Ibrahimovic (Sweden) header from the centre of the box is blocked. Assisted by Robin Quaison.
Offside, Spain. Jordi Alba tries a through ball, but Álvaro Morata is caught offside.
Substitution, Spain. Rodri replaces Gavi.
Substitution, Spain. Brais Méndez replaces Dani Olmo.
Gavi (Spain) wins a free kick in the defensive half.
Foul by Albin Ekdal (Sweden).
Foul by Gavi (Spain).
Victor Lindelöf (Sweden) wins a free kick in the attacking half.
Goal! Spain 1, Sweden 0. Álvaro Morata (Spain) right footed shot from very close range to the high centre of the goal.
Attempt saved. Dani Olmo (Spain) right footed shot from outside the box is saved in the top left corner. Assisted by Gavi.
Substitution, Sweden. Martin Olsson replaces Emil Krafth.