(CNN)A late goal from Aleksandar Mitrovic saw Serbia stun Portugal on Sunday and qualify for next year's FIFA World Cup.
Serbia's 2-1 victory in Lisbon means Portugal finished second in Group A and will have to get through the playoff in March in order to qualify for Qatar 2022.
Needing only a draw to qualify for the World Cup, Portugal's night got off to the perfect start when Nemanja Gudelj was caught in possession by Bernardo Silva, who set up Renato Sanches to give the home side the lead inside two minutes.
The goal was allowed to stand after a video assistant referee review for a foul on Gudelj.
However, Serbia equalized 30 minutes later when Dusan Tadic's deflected shot was spilled by Rui Patricio and rolled into Portugal's net.
Portugal's best chance to take the lead in the second half came through a Sanches break, but the midfielder was unable to get a clean shot away.
With the game on course for a draw, Mitrovic's back-post header from Tadic's cross grabbed a historic victory for Serbia and sparked wild celebrations on the pitch.
The goal was also enjoyed by 20-time grand slam champion Novak Djokovic, who was seen celebrating noisily in videos posted to his Instagram account, and also served as a redemptive moment for Mitrovic, whose missed penalty in a shootout against Scotland last year meant Serbia failed to qualify for Euro 2020.
The result meant Serbia finished top of Group A on 20 points, while Portugal was second on 17 and must now navigate a 12-team playoff in order to qualify for the World Cup.
Of the teams in the playoff, only three will end up qualifying for the tournament.