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.
Live Blog: Young Socceroos v Malaysia in AFF U-18 Championship Final
The Young Socceroos take on Malaysia in the final of the 2019 AFF U-18 Championship in Vietnam from 10:30pm AEST. After their come-from-behind Semi Final win over Myanmar on Saturday night, Gary van Egmond's youngsters earned the right to play for the championship at the Thong
Aussies Abroad: Behich makes debut for İstanbul Basaksehir
Caltex Socceroos defender Aziz Behich made his Turkish Super Lig debut for Istanbul Basaksehir but his new side fell to a 3-0 defeat in the season opener against Yeni Malatyaspor. Behich started alongside the likes of ex-Chelsea striker Demba Ba and former Bundesliga star Elje
Aussies Abroad: Mooy makes Brighton bow as Ryan helps secure draw with West Ham
Aaron Mooy made his Brighton & Hove Albion debut as Mat Ryan?s late heroics earned the Seagulls a share of the points against West Ham United. Javier Hernandez put the Hammers ahead on 61 minutes but Leandro Trossard?s struck four minutes later to restore parity in the Premier
Aussies Abroad: Taggart's hot streak continues with treble for Suwon against Gangwon
Adam Taggart hit his first hat-trick in more than five years to continue his scorching hot K-League goalscoring streak. The Caltex Socceroos hitman netted a treble in Suwon Bluewings? 3-1 victory at Gangwon FC to rack up 16 goals in 19 starts since his February move to the Kor