Cristiano Ronaldo's goal saw Portugal beat Ghana 2-1 in Brasilia, but it proved academic as both sides crashed out of the FIFA World Cup.
Coming into the final Group G clash, both sides knew only victory would give them a chance of progressing to the second round, and even then they were dependent on the game between Germany and the United States, with a draw in Recife good enough to see those two teams through regardless of events in the capital.
Portugal, needing a five-goal swing to overtake the USA in second place, went in front after 30 minutes when Ghana defender John Boye's wild clearance from Miguel Veloso's cross diverted the ball over goalkeeper Fatawu Dauda and into the net.
Ghana responded in the second half, Asamoah Gyan's header making him the highest ever scorer for an African nation at World Cup finals, surpassing the mark of five set by Cameroon's Roger Milla.
With Germany beating the Americans 1-0 on Thursday, a 2-1 victory for Kwesi Appiah's men would have seem them through and Abdul Majeed Waris was guilty of a glaring miss shortly after Gyan's equaliser, nodding wide from close-range with no defenders around him.
They were left to rue that miss 10 minutes from time, Ronaldo firing home from 12 yards after a defensive mix-up between Jonathan Mensah and Dauda, the keeper flapping hopelessly at a high ball.
Portugal made four changes from the side that drew 2-2 with the United States, while Ghana showed two alterations, Waris and Emmanuel Agyemang-Badu coming in for Kevin-Prince Boateng and Sulley Muntari, suspended by the Ghanaian Football Association for alleged disciplinary breaches.
Ronaldo had the first effort of note in the fifth minute as his audacious lob from wide on the right caught out Dauda but struck the crossbar and rebounded to safety.
The Portugal captain threatened again seven minutes later, testing Dauda with a trademark dipping free-kick from 30 yards.
Ronaldo was at the forefront of all of Portugal's attacking play and ought to have put his side ahead in the 19th minute.
Joao Pereira delivered a pinpoint ball from the right and the Real Madrid man, unmarked six yards from goal, directed his header straight at Dauda, who parried away.
A minute later Ghana almost hit the front as Gyan was denied by the legs of Beto after the Portugal defence failed to deal with an aerial ball.
Portugal continued to make most of the running and got their noses in front on the half-hour mark, Boye slicing Veloso's cross from the left into the net via the bar and right-hand post.
Ronaldo brought another save out of Dauda two minutes later, while Gyan continued to pose a danger, heading wide after meeting Christian Atsu's cross.
After a quiet start to the second half Ghana equalised with 57 minutes gone, Gyan nodding home at the far post following a superb cross from Kwadwo Asamoah with the outside of his left foot.
Waris wasted a glorious chance to put Ghana in front four minutes later, somehow heading wide from six yards after being picked out by Gyan.
Ronaldo - relatively quiet throughout the tournament - ultimately had the final say as he lashed in a left-footed strike after Dauda feebly palmed Mensah's wayward header into his path, but it mattered little as both sides' hopes were dashed.
|Coach: Paulo Bento|
for João Pereira 61'
for Éder 69'
for Beto 89'
|Messi retirement highlights implosion of Argentinian football|
|Bravo: I hope Messi continues playing for Argentina|
|Aguero: Messi not the only player considering retirement|
|I think Messi is just upset, Romero says after captain announces retirement|
|Aguero: This is the worst I have seen Messi|
|Messi set to retire from international football|
|Sanchez: This is the best thing to happen to me|
|Martino: Argentina deserved to beat Chile in final|
|Vidal: This Chile generation is to stand|
|Sanchez crowned Copa´s best as champions Chile sweep awards|
|Argentina 0 Chile 0 (aet, 2-4 on penalties): Defending champs sink Messi and Co. again|
|Taylor ready for Belgium test|
|Portland Timbers 3 Houston Dynamo 2: Valeri late show seals win|
|Euro 2016 Diary: Love blossoms in Paris and last orders for Ireland as Hallgrimsson baits England|
|De Bruyne, Belgium target Euro 2016 final|
|Wilmots: Hazard does his talking with his feet|
|Storck enthusiastic about Hungary future|
|My best Belgium performance - Hazard|
|´It took him long enough!´ - Schweinsteiger hails Boateng´s first Germany goal|
|Courtois: Hungary made an error by coming to play|
|No back-three fears for Spain boss Del Bosque|
|Grigg fired by Euro bench duty|
|Davis: Stranger things have happened than O´Neill to Southampton|
|Gunnarsson insists Iceland do not fear England|
|Brilliant Hazard inspires Belgium´s golden boys|
|Student Morata wants to bring down Juventus masters with Spain|
|Hungary 0 Belgium 4: Hazard inspires Wilmots´ men into quarter-finals|
|Conte demands extraordinary Italy to topple Spain|
|Nolito: No contact with Barca or Man City|
|Alves jets into Turin for Juve medical|
|Low: No sleepless nights over Italy or Spain|
|Kozak: Germany had too much quality|
|Fury gets in the spirit with England fans in Nice|
|Draxler shares the plaudits as Germany move through|
|O´Shea not drawn on Ireland future|
|Rami: France were scared of going out|
|Germany 3 Slovakia 0: Spain or Italy await for world champions after comprehensive win|
|Brilliant Boateng gets Germany juggernaut motoring|
|Lagerback hopes England´s attacking struggles will continue|
|Juventus, Napoli and Roma ´all interested in De Sciglio´|
|O´Neill hails coming of age for Ireland´s youngsters|
|England will not disrespect Iceland, says Rooney|
|Deschamps stands firm on team changes|
|Hodgson adamant he is happy with England strikers|
|Evra: We knew it would be difficult|
|Deschamps: We had to dig deep|
|Rooney: Do not question Sterling´s attitude|
|O´Neill: France´s extra rest took its toll|
|France star Payet: It is difficult to stop us|
|Griezmann: Stern words led to second-half fightback|
|Coleman: We felt it was there for us|
|Deschamps defies doubters as France heed call to arms|
|Konko ´in talks´ to join AC Milan|
|Sigurdsson looking forward to dream England clash|
|Cacic: Croatia´s time will come|
|Italy v Spain will be different to Euro 2012 final - Camoranesi|
|France 2 Republic of Ireland 1: Griezmann double rescues hosts|
|Capello: Spain are pure magic|
|Wolfsburg complete Bruma signing|
|Koke: Spain need to bring back ´The Red Fury´|
|Pizzi: Chile can beat Messi and Argentina|
|Schalke swoop for Swiss star Embolo|
|Subotic signals intention to leave Dortmund|
|Howedes eager for France showdown|
|Russia confirm Slutsky resignation|
|Pirlo: Italy out for Spain revenge|
|Vokes consoles McAuley after Wales march on|
|Italy-Spain a battle of world´s best - Llorente|
|Messi one win away from becoming the greatest|
|Play-offs the goal as Baptista settles into life in Orlando|
|Colombia closer to winning titles - Pekerman|
|MLS Review: Kaka scores 100th-minute penalty in thriller, Lampard inspires NYC|
|Portugal ´don´t have a clue how they scored´ – Rakitic|
|Klinsmann: USA should be proud of Copa America display|
|United States 0 Colombia 1: Bacca secures third place at Copa America|
|Corluka: Portugal among worst teams at Euro 2016|
|Sanches happy to be involved as Portugal reach quarters|
|Euro 2016 Diary: Shaqiri rivals Pique for Shakira´s affection, Bale reveals secret weapon|
|Morata: I have nothing to prove to Zidane|
|Di Maria fit for Copa final|
|´You do not always win by playing prettily´ - Santos unconcerned by dour Portugal|
|The best team lost, says disconsolate Cacic|
|Fabianski: Poland must create more for Lewandowski|
|McAuley pride after crushing Wales loss|
|Ronaldo takes one for the team as Portugal emerge from drudgery in Lens|
|Croatia 0 Portugal 1 (aet): Quaresma earns quarter-final berth|
|Hodgson will not beg for FA approval after Euro 2016|
|Emotional Bale glad to share Paris joy with family|
|O´Neill left frustrated by officials following Euro 2016 exit|
|Coleman hails Bale brilliance in Wales win|
|Low relying on Kroos to lead Germany the way|
|Italy v Spain: Thiago denies shirt jinx ahead of Azzurri clash|
|O´Neill: McAuley has been magnificent|
|Szczesny thanks Swiss fans for drink|
|Hector: Slovakia have plenty of quality in attack|
|Morata: Italy defenders have told me to wear a helmet|
|Coleman content with scrappy Wales progression|
|Wales remain and Northern Ireland leave after Paris battle|
|We are free of pressure - Gera|
|´Do I look like I have doubts?´ - Defiant Nawalka defends Lewandowski|
|Wales 1 Northern Ireland 0: McAuley´s woe is Welsh joy|
|No chance Barcelona star Neymar will join Madrid, says his father|
|Witsel happier to face Hungary than Spain|
|Wilmots accepts pressure ahead of Hungary test|
|Slovakia can upset Germany again - Pekarik|
|Shaqiri unhappy with Poland celebrations after Euro 2016 exit|
|Grosicki struggled to watch Poland shootout win|
|Poland need Lewandowski to rediscover ruthless streak|
|Switzerland 1 Poland 1 (aet, 4-5 pens): Xhaka shocker costs Swiss after Shaqiri magic|
|Payet can handle hero status - Deschamps|
|Redmond joins Southampton on five-year deal|
|Sturridge: Sterling unfairly targeted over England performances|
|Wilmots: I want more from smiling De Bruyne|
|Croatia star Perisic unveils latest wacky hairstyle|
|Brazil´s Lucas Lima wants European move|
|Lloris tempers talk of Ireland revenge mission|
|Deschamps refuses to make France ´98 comparisons|
|O´Neill confident Ireland can shock France|
|Chiellini will give Morata a few kicks - Barzagli|
|England v Iceland: Rooney targets early goal|
|Italy´s Candreva ruled out of Spain match|
|Butland ready for pre-season after scan gives goalkeeper all-clear|
|Origi not underestimating Hungary|
|Plans drafted for Old Firm games to be played abroad|
|Boost for Germany as Boateng trains ahead of last 16|
|I never saw Ronaldo look in the mirror! - Ancelotti|
|Fabregas fears Brexit will damage Premier League|
|Roy not keen on Ireland allocation|
|Dyke backs Hodgson for new contract|
|Spain not as aggressive as 2012, claims Ancelotti|
|Ronaldo and Messi need each other – Ancelotti|
|Juve on the same level as Madrid and Barcelona - Dybala|
|Fabregas: Conte´s Italy will be tough|
|Argentina v Chile: New year, same Copa finalists|
|Ronaldo ´cannot be the whole of Portugal´ - Shilton|
|Messi: Neymar is an amazing person|
|Pekerman keen to finish Copa on high note|
|Rakitic: Ronaldo won´t sleep easily|
|Messi: Now is not a time to give nothing|
|Courtois expects to leave Chelsea in future|
|Less rest no problem for Portugal - Joao Mario|
|Euro 2016 Diary: Benteke rap and Nelly the elephant|