Cristiano Ronaldo wasted a succession of glorious chances as Portugal bowed out of the World Cup on Thursday despite beating Ghana 2-1 in Brasilia.

Portugal knew only a win combined with a defeat for Germany or the United States in the other Group G fixture, plus a significant swing in goal difference, would take them through to the last 16.

Germany won the group with a 1-0 win over the US, who also qualified on goal difference over Portugal.

Although Ronaldo netted his first goal of the tournament, the winner, it was his numerous misses that cost Portugal the sizeable victory they needed to make up for the 4-0 mauling they suffered by Germany in their first game.

Ronaldo
Portugal's Cristiano Ronaldo scores his side's second goal during the group G World Cup soccer match between Portugal and Ghana on Thursday, June 26, 2014. - AP Photo/Martin Mejia
"The match today was a match we tried to win and we did win. We created many opportunities but we could not finish them all," said a disappointed Ronaldo, who won the man-of-the-match award.

"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.

"We deserved more but that's how football is. We can hold our heads up high. We tried our best but couldn't do it."

Portugal had taken the lead through a John Boye own goal before Asamoah Gyan equalised.

The Europeans broke the deadlock after half an hour with an own goal by the unfortunate Boye, who diverted a cross by Miguel Veloso off his knee and over despairing goalkeeper Fatawu Dauda.

The move that led to the goal started when the ball hit the referee in the middle of a promising-looking attack by Ghana, missing two of their star players after bust-ups with management.

Sulley Muntari is accused of attacking a member of the management team while Kevin-Prince Boateng is said to have verbally abused national team coach Kwesi Appiah, the GFA said on its website.

Ronaldo, who last month helped Real Madrid to a 10th Champions League title, had already come close to scoring on a number of occasions before the first goal.

After a scrappy opening few minutes he picked the ball up wide on the right and hit a wayward cross that sailed over Dauda only to come back off the crossbar.

He then tried his luck with a free-kick from 25 yards in a central position which Dauda beat away.

Squandered chance

The 29-year-old looked certain to score as he rose unmarked to meet a cross from seven yards out but headed straight at Dauda, who made an instinctive reaction parry.

Moments later Portugal goalkeeper Beto kept a close-range shot from Gyan out with his legs as the action swung from end to end.

The Black Stars put pressure on Portugal after the break, with captain Gyan producing a shot from just outside the penalty area that skimmed narrowly wide.

Shortly before the hour mark Ghana's persistence earned reward when Gyan headed home at the far post from a sublime cross by Kwadwo Asamoah, delivered with the outside of his left boot.

Gyan thus became the top African goalscorer at World Cups with his sixth effort in finals.

Just four minutes later the African team should have been ahead after Majeed Waris squandered a glorious headed chance from close range as the Black Stars began to get on top.

Ronaldo kicked the air in frustration as another attack foundered, with news filtering through from soggy Recife that Germany were 1-0 up against the United States, meaning both Ghana and Portugal were back in the mix.

And Portugal's winner came in heartbreaking fashion for Ghana with 10 minutes to go after Dauda pathetically pawed at a dropping ball, giving it straight to Ronaldo to fire home low into the corner.

Portugal coach Paulo Bento refused to blame Ronaldo for not scoring more goals.

"I don't think we should now make those things individual. We made a set of mistakes in the tournament during three different matches."