Cristiano Ronaldo’s second-half winner gave Portugal a 2-1 victory over Ghana, but the result means that neither team progress to the World Cup’s last 16.
Ghana defender John Boye gifted Portugal the lead when he turned a cross into his own net, but Asamoah Gyan headed in an equaliser.
Ronaldo capitalised on a poor clearance to sweep home and give Portugal hope.
But they could not find the three more goals they needed to prevent the United States advancing on goal difference.
The USA lost to Group G winners Germany 1-0 in the section’s other game.
Ronaldo’s goal was his first in what was ultimately a disappointing tournament for a player who had scored 51 times in 47 appearances for Real Madrid last season.
The 29-year-old, who has suffered from knee and thigh injuries, failed to replicate the influence he had at club level as Portugallost heavily in their opening group game against Germany, before a draw with USAleft them needing to win by a large scoreline against Ghana to progress.
Ronaldo was given the freedom to roam across the Portugal frontline against the African side and, initially, he was at the centre of their best chances.
First, he almost caught out scrambling Ghana goalkeeper Fatawu Dauda with an audacious chip that smacked the crossbar, before his close-range header from Joao Pereira’s pinpoint cross was instinctively batted away by Dauda, who turned and roared in delight at the Ghana fans behind his goal.
His joy, though, was short-lived, as Ghana conceded an unfortunate opener midway through the half.
Joao Moutinho fed Miguel Veloso on the left and he delivered a teasing cross that Ghana centre-back Boye deflected into the top corner of his own goal with his thigh.
While Portugal’s problems have solely been on the pitch, Ghana’s preparations were hampered by chaos behind the scene.
Midfielders Sulley Muntari and Kevin-Prince Boateng were expelled from the squad for alleged indiscipline – although Muntari would have missed the Portugal game anyway through suspension after picking up yellow cards in their first two games – while players had even threatened to boycott the Portugal fixture because of a row over appearance fees.
ir enterprising build-up play, it seemed Ghana would need a moment of magic to get back into the game.
That arrived just before the hour as Kwadwo Asamoah curled a stunning cross with the outside of his boot towards the far post, where Gyan was on hand to plant a header into the net.
With Germany leading the USA at the time, qualification suddenly became a realistic possibility for Ghana and they came agonisingly close to securing the win they needed when Majeed Waris flicked a header just wide from Gyan’s cross.
However, Dauda ended his own side’s hopes of securing victory when he pawed at a Portugal cross, clearing only as far as Ronaldo, who made no mistake.
Portugal coach Paulo Bento:
“It’s not fair to blame individuals. We made mistakes as a team in the three matches – and I will never hold any individual responsible. We win and lose as a team.
“It’s a tough time for us and we feel down as we all wanted to qualify for the Round of 16. We must now grow and advance so that we don’t feel the same in 2016.”
Portugal forward Cristiano Ronaldo:
“We created many opportunities but we could not finish them all. We knew we had to score three goals and we were depending on the result of the Germany game.
“We knew it was complicated but what’s left at the end shows that it was possible considering the number of opportunities we created during the game.”
Ghana coach Kwesi Appiah:
“It was a very exciting match with many chances on both sides.
“Unfortunately we didn’t take ours and they took theirs.”