Spain and Croatia did secure their places in Qatar on Sunday thanks to 1-0 wins over Sweden and Russia respectively.
Ronaldo already holds the record of playing in five European Championships and looked well on course for another milestone as Portgual stormed out of the blocks to open the scoring after just two minutes through Renato Sanches.
However, Serbia bounced back to dominate the remainder of the first half and deservedly levelled when Dusan Tadic's strike squeezed in off the post after Dusan Vlahovic had hit the woodwork.
Ronaldo was kept quiet as another chance to score his 800th career goal came and went.
Instead it was Aleksandar Mitrovic who grabbed the vital goal as stoppage time approached.
Just over a year ago, Mitrovic was the villain for his country as he was the only player to fail to score in a penalty shootout against Scotland that saw Serbia miss out on Euro 2020.
However, the Fulham striker made amends in dramatic fashion when he steered in Tadic's header at the back post.
"It was an amazing game," said Mitrovic. "We were the better team today in every aspect of the game."
Portugal must now navigate two tricky one-off playoff matches in March to maintain their record of qualifying for every major tournament since the 1998 World Cup.
'Huge weight off'
"We must apologise to the Portuguese but my team will be at the World Cup, that's guaranteed," said defiant Portugal coach Fernando Santos.
"We will have to prepare well to beat our opponents in March and to get to Qatar. But I always trust my players."
Spain made sure they avoided the playoffs as Alvaro Morata's goal four minutes from time ended Sweden's resistence in Seville.
The Swedes' shock 2-0 defeat to Kazakhstan on Thursday had handed Spain pole position in Group B, meaning La Roja just needed a point to qualify.
Luis Enrique's men were grateful for that reprieve as for a long time a repeat of the stalemate between the sides when they met in the group stages of Euro 2020 was on the cards.
Morata was the fall guy that night for missing a host of chances, but made his mark off the bench with a calm finish after Robin Olsen had turned Dani Olmo's blistering shot onto the bar.
"To be honest, it is a huge weight off my shoulders," said Luis Enrique. "I felt much more pressure in these games when people think it is easy to get a result than in the Euro or the Nations League."
Croatia also needed a late winner as an own goal from Fedor Kudryashov snatched qualification from Russia in a battle in boggy conditions in Split.
Finalists at the last World Cup in 2018, Croatia looked bound for the playoffs as they toiled on a waterlogged pitch against a resolute Russian defence.
But Kudryashov's error saw them snatch top spot from the visitors eight minutes from time.
"It was a difficult match from the beginning because of the rain. We never gave up, we were patient and I think we won deservedly. We are the best team in this group," said Croatia captain Luka Modric.
Germany had long since booked their place in Qatar, but rounded off their qualifying campaign with a 4-1 thrashing of Armenia as Ilkay Gundogan scored twice.
North Macedonia secured the playoff place behind the four-time world champions with a 3-1 win over Iceland.
© 2021 AFP