Serbia qualified for the World Cup for the second time since becoming an independent nation in 2006 after beating Georgia 1-0 on Monday, while Ireland won in Wales 1-0 to seal second place and a spot in the playoffs.
At the end of a tense final round of qualifying in Group D, Gareth Bale's Wales dropped to third place and was out of contention for a place in next year's tournament in Russia — 15 months after reaching the semifinals of the European Championship.
Fireworks filled the sky after fulltime in Belgrade as Aleksandar Prijovic's 74th-minute goal ensured Serbia topped the group by two points and was back in soccer's biggest stage for the first time since 2010.
The Serbs took their second chance to secure qualification, after losing in Austria on Friday.
With Serbia winning, the Celtic showdown between Wales and Ireland in Cardiff was for the prize of a playoff berth in November.
Ireland took it, thanks to James McClean's 57th-minute goal following a defensive mix-up by the Welsh. Jeff Hendrick robbed Ashley Williams, who failed to clear after receiving an under-arm pass from his goalkeeper, before racing down the touchline and crossing for McClean to shoot first-time into the net.
Defending deeply, and in numbers, and scoring on a counterattack, it was a classic away performance from Ireland against a Wales team that hadn't lost in Cardiff in four years.
"That last half hour seemed an eternity," Ireland manager Martin O'Neill said. "We had to withstand pressure but we knew at some stage we would have to try to win the game and we did it.
"The goal was worthy of winning any game."
The Irish are looking to qualify for the World Cup for a fourth time — and first since 2002. They will not be seeded in the playoffs draw, which takes place in Zurich on Tuesday, and could therefore face European champion Portugal or four-time world champion Italy.
Bale, the Real Madrid star, was absent through injury for a game that might prove to be Wales coach Chris Coleman's last in charge.
"I'm not thinking about that. We'll let the dust settle," Coleman said.
"Right now, the only picture in my mind is the faces of the players in the dressing room and the disappointment. They are inconsolable at the moment."
Wales, which fell to its only loss in this qualifying campaign, hasn't played at the World Cup since 1958, its only appearance in the finals.