Former Toulouse scrum-half Samuel Marques nailed a last minute penalty to secure a 16-16 draw with the USA on Friday which handed Portugal the 20th and last place in the 2023 Rugby World Cup.
The draw in Dubai was enough for the Portuguese to win the final qualifying tournament at the expense of the much-fancied Americans who will sit out the tournament in France next year.
VOTE FOR EMILY CHANCELLOR AND LALAKAI FOKETI FOR WORLD RUGBY TRY OF THE YEAR
The Portuguese, who had already hammered Hong Kong (42-14) and Kenya (85-0), qualified with a far superior points difference.
They will make their second appearance at the finals - and their second in France, having also qualified in 2007.
Portugal will play in Pool C with Wales, Australia, Fiji and Georgia.
"It's hard to explain, it's one of the best feelings in the world," said Portugal captain Tomas Appleton.
"For the rugby community this is amazing. We've been missing for quite some time and we need a new generation to inspire the kids."
Portugal, who are coached by former France flyer Patrice Lagisquet, were fortunate even to be in the final repechage tournament, benefitting from Spain's disqualification for fielding an ineligible player.
It is a major disappointment for the United States who had already missed a chance to qualify this summer by failing in the play-off against Chile, who are through to their first World Cup.
It is only the second edition they will have missed, having also failed to qualify for the 1995 event in South Africa.
Boosted by the presence of a number of France-based players, many of whom play in the second division, Portugal scored the first try through Beziers wing Raffaele Storti.
The boot of Bristol Bears outside-half AJ MacGinty kept the Eagles in touch and a try by hooker Kapeli Pifeleti on the hour gave them the lead.
Cometh the moment, however, cometh Marques. The 33-year-old, who played 88 Top 14 matches for Pau, Toulouse and Brive before moving to second division Carcassonne last season, hit the post with an attempted drop goal as Os Lobos pressed for the draw.
He kept his cool, however, and moments later he had a second chance. Using all his experience, he leathered the late penalty, the last kick of the game, between the posts to tie it up at 16-16 and send Portugal to the World Cup.