A 57th-minute strike from substitute Nuno Gomes eased the worries of a nation as Portugal, the UEFA EURO 2004 hosts, advanced to the knockout stages at the expense of Iberian rivals Spain.
The significance of the occasion where Portugal needed a win and Spain only a draw denied the fans a truly wonderful derby, but Nuno Gomes' goal finally ended a 23-year wait for the Portuguese to put one over their old adversaries. Portugal advance to the last eight as Group A winners, ahead of Greece and with Spain eliminated in third.
The only goal came at a moment when Portugal coach Luiz Felipe Scolari was desperately trying to shuffle his attacking options as his side struggled to breach a stubborn Spain defence. With Nuno Gomes introduced for Pauleta at the interval, the switch paid instant dividends as Luís Figo found the substitute, who unleashed a right-footed shot from 18 metres that beat Iker Casillas low to his right.
Scolari made only one change to the side that defeated Russia 2-0 as Cristiano Ronaldo's impressive performance after his introduction in that game was rewarded with his inclusion in the starting lineup, only his second start for the country. Simão dropped to the bench.
Spain coach Iñaki Sáez was forced into two changes due to injury and suspension to Joseba Etxeberria and Carlos Marchena respectively. Juanito and Joaquín came into the team, with Fernando Torres and Xabi Alonso also starting.
With Deco marshalling the midfield and Figo and Ronaldo periodically changing flanks, Portugal had the upper hand in the early exchanges. However, some poor deliveries ensured Casillas' goal was rarely threatened in a tense opening 15 minutes where Pauleta and David Albelda were both cautioned; the former's booking ruling him out of the quarter-final.
Spain offered little in attack until Vicente's left-wing centre eluded Raúl González inside the penalty area. Almost immediately, Ronaldo's low ball in at the other end forced Iván Helguera into a hurried clearance with Pauleta lurking menacingly. Deco then had a snap-shot from 12 metres blocked.
Miguel ventured forward to force the first save of the game with Casillas diving to his left to palm away. Again Spain responded, but Ricardo was quickly off his line to deny Torres outside his penalty area. Spain came close once more after 34 minutes, but Raúl failed to control Vicente's cross and Nuno Valente and Ricardo combined to clear.
On the stroke of half-time both sides spurned gilt-edged opportunities. First Torres nodded Xabi Alonso's corner over when unmarked in front of goal, then Ronaldo headed wide Figo's left-wing cross.
Jorge Andrade had to make up ground to cut out Vicente's left-wing cross early in the second half as Raúl threatened, before Maniche tried his luck from range and missed the target. Nuno Gomes' goal caused more urgency in Spain's play, and Torres thumped the ball against the post when he latched on to Alonso's through ball as the hosts defended desperately.
Ricardo Carvalho had to be alert to Vicente's lob as he cleared when Ricardo was stranded. From the resulting corner, Juanito headed against the crossbar with a looping effort before a drive from Vicente went wide. Torres then saw his header sail narrowly beyond the post.
Yet it was Portugal who squandered the best opportunity of all when Costinha headed Nuno Valente's cross over with only Casillas to beat two minutes from time. Maniche had his shot cleared off the line by Raúl Bravo after he latched onto Nuno Gomes' wonderful through ball as the home side finished the game and their group on top.