Mohamed Salah netted his second goal of the World Cup but Saudi Arabia scored with the last kick of the game to end their campaign with a 2-1 win over Egypt.
Salah, who is at the centre of reports that he is quitting international football, was initially left out of the starting line-up but was later reinstated after an apparent human error.
And the Liverpool forward opened the scoring after running onto Abdallah Elsaid’s long ball to lob the keeper with a fine finish.
After Salah should have made it 2-0 from close range, the Pharaohs were on the back foot and conceded a controversial penalty when Ahmed Fathy was penalised for handball.
But 45-year-old goalkeeper Essam El Hadary, the oldest ever player to feature in a World Cup finals, was the hero after producing a stunning save to keep out Fahad Al-Muwahhad’s spot kick.
Saudi continued to dominate and were awarded a second penalty in stoppage time after a shirt pull by Ali Gabr. After a three minute delay due to a VAR review, Salman Al-Faraj stepped up to score.
Hector Cuper’s side were lacklustre in the second period and had veteran El Hadary to thank to keep out headers from Hussain and substitute Yahya Alshehri.
But Saudi clinched a deserved victory in the 95th minute in the desert derby through Salem Al-Dossari’s well taken strike from a tight angle to end their campaign on a bright note.
The buildup to the game saw the Egyptian FA deny reports Salah was on the verge of quitting after cryptic tweets from his agent over criticism the Liverpool player has received.
He was then omitted from the line-up for the game but later reinstated. Salah performed well in the first half and scored a sublime goal but his celebration was muted.
Meanwhile, a record-breaker, Essam El Hadary won the Man of the Match award after produced a stunning save to push Fahad’s penalty onto the bar. And he was at his best again in the second half to tip over Hussain’s header to prove age is but a number.