By Duncan Walker
BBC News Online in Lisbon
All Portugal seemed to be celebrating the result
With a first-round exit from Euro 2004 beckoning, it could have been a disastrous night for the Portuguese.
But after a vital victory over their Spanish neighbours, Portugal are set for the quarter finals - and their jubilant fans are suddenly talking about winning the tournament.
"We're going to be champions," said student Joaquin Pedro. "Tonight could have been the end but now we're the best".
Unexpectedly dumped out of the championships, the thousands of Spanish in town for the game against their great rivals are beginning the long journey home.
"We're driving back to Madrid straight away," said Carlos de Sallas, 21. "There's no point in staying after this."
In the hours before kick-off things had been so different.
Taking over central Lisbon with their matador hats, drummers, whistles and flags, the Spanish had been confident of victory.
The Spanish were in upbeat mood - but that was before the match
Portugal had never beaten them in a competition, and last defeated them 23 years ago in a friendly match.
The daunting record had not escaped the notice of their hosts - many of them had expected to be out of their own tournament when the final whistle blew.
"It is important for us to beat the Spanish, just like the English want to beat Germany or France," says one. "But maybe we will meet a friendly referee."
But things did not turn out that way, the young crowd at the big screen going wild as Nuno Gomes scored what turned out to be the game's only goal.
Mother-to-be Zita Duaret said: "I'm very happy, maybe I'll call my child Nuno if Portugal are successful."
Bring them on
In the hour before the game started, the empty street had served as a clue to the fact that most of Portugal's 10 million people had more than a passing interest in the result.
The point was driven home for hours afterwards, as all Portugal seemed to take to their cars, with a cacophony of horns and singing.
Hair today, gone tomorrow - after the match, Spanish fans headed home quickly
The Portuguese are now looking forward to the next round, where they will quite possibly meet England.
"Bring on France or England, we can even beat both of them at the same time," said Zita's husband Vitor.
News of Russia's unexpected victory over Greece gave Spanish fans brief hope.
But it was short-lived, as it became clear Greece would be the second team from Group A to go through.
A few desolate Spanish fans who were hanging around quickly melted away leaving Portugal to get on with its celebrations.
"We will be singing and dancing for hours - after this we deserve a party," said Zita.