Fiji secured a quarter-final against England in Marseille in a week's time but the glory in a mesmerising match at Stadium de Toulouse went to Portugal as they won their first ever Rugby World Cup game, defeating Fiji 24-23.
Australia's future in the competition rested with Os Lobos denying the Flying Fijians a point from this final Pool C match, the last of 40 pool stage contests at Rugby World Cup 2023.
That remained a possibility throughout the game, with the 3-3 half-time scoreline raising the prospect of Patrice Lagisquet guiding Portugal to their maiden win in his final match as head coach.
His team flew out the traps in the second half and wing Raffaele Storti outpaced the Fijians to score Portugal's opening try. With Fiji rattled, Rodrigo Marta gathered a high ball and raced forward in a thrilling attack, chasing a second try. However, full-back Sireli Maqala scooped the subsequent loose ball and weaved his way through the red shirts as Fiji launched an attack of their own. He was eventually brought to ground but the impetus was there for Levani Botia to barrel over, his converted try making it 10-10.
The props then came to the fore in this astonishing encounter. Francisco Fernandes forced his way over while Botia was in the sin bin and it took a further 17 minutes for Fiji to level through Mesake Doge, also crossing the try line from close range. Two late Frank Lomani penalties looked as if they had ended the game as a contest only for Marta's late try and Samuel Marques's nail-biting conversion at the death giving Portugal a historic victory. Fiji progress in second place behind Wales in Pool C thanks to their losing bonus point.
Portugal were backed by thousands of fervent supporters, their emotion mirrored in the comments of Nicolas Martins, Mastercard Player of the Match.
"It's incredible, all the public are for us and Fiji are playing well but all these - I don't have the words," said the Portugal flanker, gesturing to the crowd.
"It's historic, I'm so happy. I think it's the best moment of my life. We are a team of friends from Portugal but we live together, it's something incredible."
In their first Rugby World Cup since 2007, Portugal had come close to the win they craved two weeks ago when they drew 18-18 with Georgia in the same stadium. The joy at finally achieving victory was expressed by their captain, José Lima, who said: "You can see our fans, our team deserve that victory so much. I think today we showed the world we can compete and win at this level."
Commenting on the suggestion his team were tired even before kick-off, Lima said: "It comes from the heart when you are tired, you have to think of all the stuff before. Get with your partners and say 'let's go, let's do it'.
"That's what we said at half-time and look at this, it is unbelievable. Just a little word for the guys [who weren't in the match-day 23 as they helped us too]."
Lagisquet, being interviewed on the pitch amid the celebrations, said of the fans: "I love them, they are incredible. They support this team for 80 minutes. You can hear them, I love them.
"It couldn't be better [to leave with a win]. I am so lucky to train a squad like this one. I am so lucky to finish with this victory, it's a great moment.
"It's incredible. It's unbelievable, they always find resources I never expected."
His counterpart, Simon Raiwalui, said Portugal "fully deserved" the victory.
"Congratulations to Portugal, they played really well," said the Fiji head coach. "Disappointed not to get the win, we dropped too much ball. We were a bit tight in the context of the game."
And looking ahead to the last-eight match, Raiwalui added: "England are a very good tournament team and we're expecting a tough game. We'll regroup, review and then get on to England."
Flying Fijians captain Waisea Nayacavelu also praised Portugal before admitting the squad would have to work on their mistakes before facing Steve Borthwick's team.
"We've got to do our fine-tuning for next week, regroup and refocus and take it up to the next level."