Cristiano Ronaldo headed Portugal into the semi-finals of the European Championships at the expense of the Czech Republic in Warsaw.
The Real Madrid forward had twice hit the woodwork and seen his side have a goal chalked out for offside before he arrived on cue in the six-yard box to nod in Joao Moutinho's cross on 79 minutes.
The Czechs - with captain Tomas Rosicky, the Arsenal midfielder, only on the bench because of an Achilles injury - had started brightly, but lacked a decisive move in the final third.
It had been a decent opening from Michal Bilek's side as Petr Jiracek drilled the ball in from 20 yards, but his effort was blocked by Real Madrid defender Pepe.
Portugal coach Paulo Bento named an unchanged side having beaten Holland to qualify behind Germany out of the 'Group of Death' for the last eight.
Manchester United winger Nani and Madrid star Ronaldo, who would miss the semi-final if he picked up another caution, were the most lively for the Portuguese.
On 17 minutes, the Czech Republic, who overcame a 4-1 defeat in their opening game against Russia to win Group A, broke quickly down the right and Vladimir Darida whipped over a low cross through the six-yard box, which Galatasaray striker Milan Baros just failed to connect with.
Ronaldo was played into the Czech box, holding off Michal Kadlec, and drilled the ball goalwards with Chelsea keeper Petr Cech making a smart save. However, English referee Howard Webb had blown for a foul by the Portugal forward, who could not believe the decision against him.
On 26 minutes, Nani went into the Yorkshireman's notebook after tripping David Limbersky.
The game was starting to open up as Czech full-back Theodor Gebre Selassie cut in from the right and crossed, with Pepe again alert to clear the danger.
At the other end, Ronaldo - who netted a brace against the Dutch - went close with an overhead kick at the far post.
The former Manchester United forward was then just off target again with an ambitious long-range free-kick.
Portugal were forced into a change six minutes before half-time when striker Helder Postiga pulled up with what appeared to be a hamstring problem, and was replaced by 6ft 3in Besiktas frontman Hugo Almeida.
Nani claimed for a penalty after going down in the box under close attention from Limbersky, but the referee was unconvinced, with TV replays showing the United forward slipped rather than was pushed.
Portugal continued to press and Ronaldo was within inches of a spectacular opening goal when he collected a high ball into the box on his chest, swivelled around marker Kadlec and crashed the ball past Cech - only for it to strike the base of the near post.
There was another great chance for Portugal at the start of the second half, when Almeida headed over from 12 yards after being picked out by Raul Meireles' cross.
On 50 minutes, Ronaldo was denied by the woodwork again as this time his 30-yard free-kick clipped the outside of the far post with Cech beaten.
The Chelsea keeper then had to parry away a 25-yard strike from Nani, and only an offside flag prevented Portugal taking a deserved lead on 57 minutes when Almeida glanced in the United winger's cross.
The Czechs produced a counter-attack when Vaclav Pilar charged down the left and into the penalty area, only to produce a poor final pass, which was hacked clear.
Portugal were soon back on the offensive as Moutinho's dipping 25-yard effort was tipped over.
Kadlec was then left in a heap after being clattered by goalkeeper Cech, who punched clear at the edge of the penalty area.
The Chelsea man's goal was leading a charmed life, as Nani's floated ball was deflected behind.
Ronaldo finally broke the deadlock on 79 minutes, when he sent a diving header past Cech from Moutinho's right-wing cross.
Portugal continued to pour forwards, with Cech beating away an angled 25-yard effort from full-back Joao Pereira.
Ronaldo went down under a challenge from Gebre Selassie and, although he appeared to be caught by the Czech defender, referee Webb again waved play on.
Portugal saw out four minutes of stoppage time to secure their place in the semi-finals, where they will face either Spain or France.