Egypt held their nerve to beat Australia 4-2 on penalties and secure their first World Cup knockout victory following a 1-1 draw after extra time in a cagey last-32 match at Dallas Stadium.
Hossam Abdelmaguid rolled in the winning spot-kick after Harry Souttar and Lucas Herrington missed from 12 yards for the Australians to send Egypt into a last-16 clash with Argentina or Cape Verde.
Emam Ashour had given Egypt the lead with a 13th-minute header before an own goal by Mohamed Hany 10 minutes into the second half levelled the scores.
"It's history," said Egypt captain Mohamed Salah, who was a surprise inclusion in Egypt's starting line-up after recovering from a hamstring strain.
"I told the boys before the game: Guys, this is the biggest stage you could play in your life, so just enjoy it. Don't let the pressure get into you and not enjoy the moment. I'm glad that we managed to win the game. Bad luck for them, they lost on penalties but I'm happy that we wrote history today."
Cristian Volpato gave the African side an early scare with a dipping strike from distance that clipped the top of Mostafa Shoubir's crossbar but Hossam Hassan's side were soon in front.
Jackson Irvine needlessly gave away a free kick to the left of the penalty area when he upended Mostafa Zico and, with the defence only half clearing Ashour's initial centre, the winger popped up to head Karim Hafez's cross beyond Patrick Beach.
MARMOUSH THREATENS
Omar Marmoush threatened briefly and Australia's Aziz Behich forced Shoubir to drop to his right to gather before Volpato, the Socceroos' most creative outlet in the opening half, curled a stoppage-time strike wide.
The Australians were fortunate not to go further behind within 10 seconds of the restart when Marmoush slid his shot across goal with Beach beaten and they were soon level.
Aiden O'Neill picked himself up after being fouled on the left to deliver an inswinging free kick into the six-yard box, prompting Hany to flick a header into his own goal.
Beach pulled off a reflex save deep into stoppage time, the Melbourne City goalkeeper pawing Ramy Rabia's header over the bar while Haissem Hassan's effort was deflected to safety by Souttar's outstretched knee.
An unmarked Salah, who had been muted throughout regulation time, thumped Marmoush's layoff over the bar three minutes into the extra period to grant Tony Popovic's side a reprieve with Egypt increasingly dominant.
Beach made way for Mat Ryan between the posts as Australia coach Tony Popovic attempted to make use of the 34-year-old's experience but Souttar fired the first spot-kick over the bar to hand Egypt an early advantage.
Mahmoud Saber, Ramy Rabia and Salah were all on target for Egypt with Jackson Irvine and Awer Mabil converting for Australia before Herrington rattled the crossbar and Abdelmaguid stepped up to send Egypt into the last 16.
"It's tough," said Popovic. "We showed the world that Australian football is strong, they're a wonderful group and I'm devastated for them. Unfortunately we go home and the World Cup ends for us."

Colombia beat Ghana 1-0 to set up Switzerland showdown
Argentina survive Cape Verde upset bid in extra time thriller
Djokovic reaches another milestone, Sinner warming to the task
Gauff tames Liu in Wimbledon 3rd round, Sabalenka beats Ostapenko
Ecstatic Hamilton puts Ferrari on pole for Silverstone sprint