Spain suffered their first World Cup qualifying defeat since 1993 as Sweden came from behind to end La Roja’s 66-game run.
Carlos Soler volleyed Luis Enrique’s Spain into an early lead in Stockholm on his international debut.
But just 12 seconds after play resumed Alexander Isak took advantage of a defensive mistake to slam home.
Viktor Claesson controlled Dejan Kulusevski’s pass before firing in a famous winner from 12 yards out.
The previous team to beat Spain in a World Cup qualifier were Sweden’s neighbours, Denmark, in March 1993 in Copenhagen.
Since then Spain had won 52 World Cup qualifiers and drawn the other 14.
The win takes Sweden top of Group B on nine points from three games.
Spain have seven points from four games and could be facing a play-off for a place at the 2022 World Cup with only the group winners qualifying automatically.