Cristiano Ronaldo scored his first goal of the tournament but missed a glut of other chances as Portugal's 2-1 win over incident-hit Ghana on Thursday (local time) was not enough to make the second round as both sides exited the World Cup.
Portugal finished level on four points with the United States in Group G but the Americans advanced to the last 16 courtesy of a better goal difference despite their 1-0 loss to group winners Germany in Recife.
"We are very disappointed. We have to go home and come back stronger," Ghana's goalscorer Asamoah Gyan said after they finished bottom of thr group with one point.
Ghana defender John Boye's first-half own goal summed up a match that disappointed for long spells between two teams who needed victories - Portugal by a large margin - in the Brazilian capital to have any chance of advancing.
The defender swiped at a 31st minute cross from Portuguese fullback Miguel Veloso which hit his knee and then the crossbar before nestling in the back of the net.
The goal came after a Ghana break ended when Bahrain official Nawaf Shukralla accidentally blocked an attempted pass, handing possession to the Portuguese who went up field and scored.
The Ghanaians improved after the break and striker Gyan headed them level at the back post after a brilliant cross with the outside of his foot by Kwadwo Asamoah in the 57th minute.
Gyan then turned provider, putting in another ball from the left for an unmarked Abdul Majeed Waris moments later but the striker could only steer his header wide from six yards out.
The wasted effort proved costly as Portugal skipper and World Player-of-the-Year Ronaldo smashed his side ahead in the 80th minute after Ghana goalkeeper Fatawu Dauda flapped at a high ball, sending it straight to the Real Madrid forward.
Ronaldo should have had another minutes later but Dauda was on hand to parry the forward's side footed effort from close range, with the keeper also blocking an effort from the skipper in the dying stages as the game finally burst into life.
"It was a very exciting match with many chances on both sides," Ghana coach Kwesi Appiah said. "Unfortunately we didn't take ours and they took theirs."
The World Cup exit completed a miserable two days for the Africans who were embroiled in a pay row and kicked out midfielders Kevin-Prince Boateng and Sulley Muntari for ill-discipline hours before Thursday's kick-off.
Will Burnley retain their EPL status?