Alvaro Morata scored a massive late goal for Spain to book their 2022 World Cup spot, while Dusan Vlahovic’s Serbia shocked Portugal.
Spain knew a draw would be enough against Sweden, but despite dominating for most of the match, they struggled to break through.
Juventus striker Morata came off the bench and proved decisive, a smart dinked finish on the rebound from a parried Dani Olmo effort.
Sweden introduced Zlatan Ibrahimovic only for the closing stages in a desperate bid to turn things around.
The 40-year-old Milan striker only made an impact on Cesar Azpilicueta during a late altercation.
It means Sweden are in the World Cup play-offs, just like the 2018 edition.
Serbia completed a remarkable turnaround to win 2-1 in Lisbon and book their spot at the World Cup in this head-to-head showdown.
Renato Sanches had put Portugal in front in only the second minute, but Roma goalkeeper Rui Patricio fumbled a deflected Dusan Tadic effort and in the final minute Aleksandar Mitrovic nodded in at the back post.
Fiorentina striker Dusan Vlahovic had a goal ruled offside and thumped the upright.
Cristiano Ronaldo was left in tears at the final whistle, as Portugal will go into the play-offs.
Eljif Elmas of Napoli helped North Macedonia secure a play-off spot, beating Iceland 3-1.