Liverpool star Mohamed Salah scored from a penalty kick deep into injury time to send Egypt to the World Cup and end a near 30-year wait for Africa's most successful team.
Salah scored both Egypt's goals in a 2-1 home win over Republic of Congo in the penultimate round of qualifiers in Africa on Sunday (Monday AEDT).
Egypt qualified for the World Cup for the first time since 1990 and Salah's powerful left-footed penalty in the fourth minute of injury time dramatically delivered the win they needed to make sure of their place.
It unleashed joy across a football-mad country of nearly 100 million people used to bitter disappointment when trying to qualify for the world's top football tournament.
The win sent hundreds of thousands of fans across Egypt celebrating, honking car horns and waving the country's red, white and black flags.
In Cairo, an army helicopter dropped hundreds of Egyptian flags on thousands of fans gathered at the city's iconic Tahrir square.
Egypt was the second African country to qualify for the 2018 World Cup in Russia after Nigeria clinched its place on Saturday. The other three African qualifiers will be decided in the final qualifying games next month.
Salah thought he had won it for Egypt with his first goal in the 63rd minute. But Egypt was stunned by a ferocious volley by Republic of Congo substitute Arnold Bouka Moutou to level the scores in the 86th.
Egypt substitute Mahmoud Hassan was brought down in the box two minutes into injury time and Salah, Egypt's star player, clinched victory from the spot.
The game was held in front of a capacity crowd of 30,000 at a military stadium in the Mediterranean port city of Alexandria, a reminder of the political turmoil Egypt has endured over the last six years.
That turmoil affected the soccer team, too, with the record seven-time African champion failing to qualify for three straight African Cups from 2012-2015 before making a return this year. Argentine coach Hector Cuper led Egypt to the African Cup final in February on that return, eventually losing to Cameroon.
The World Cup qualification was Cuper's greatest achievement, though. Egypt, an African giant and founding member of the Confederation of African Football, has only played at two World Cups before - in 1934 and 1990.
Egypt will now finish top of Group E, making sure of its place at the World Cup with a game to spare against Ghana next month.