Maximise Your Healthcare Benefits
Ronaldo, appearing in his 900th career match, made his mark to devastating effect as time ran out.
First, he pulled his team level with a header from a Ricardo Quaresma cross, before adding the winner in almost identical circumstances in the fourth minute of injury time.
However, the 33-year-old Real Madrid star had to wait for the VAR system to validate his goal after a suspicion of offside. His two-goal salvo took his Portugal tally to 81.
Earlier, Salah, who has shone at Liverpool this season with 28 Premier League goals, broke the deadlock in Zurich after 56 minutes.
After a quickfire exchange of passes, Abdallah El Said found Salah in space for his teammate to beat Beto in the Portuguese goal with a sweetly-timed left-foot strike from the edge of the area.
“In the last minutes we were better, created four chances and showed great determination to turn it around. They showed that they did not want to lose,” said Portugal coach Fernando Santos.
“And with Ronaldo, it’s about a goal and another goal.”
Ronaldo had two first-half chances blocked as he tried to continue his impressive recent form which had seen him score 18 goals in his last nine La Liga games, including registering a 50th hat-trick.
Salah was replaced late in the game by Shikabala and Portugal sensed a chance to grab a share of the spoils.
Quaresma, meanwhile, saw a 72nd minute attempt saved by Mohamed El-Shenawy in the Egypt goal while Bruno Alves saw a close-range header from a corner drift wide of the goal.
Shikabala had a fierce shot saved by Beto diving high to his right before Alves’s frustrations boiled over late in the game with a yellow card.
But with time running out, Ronaldo had the final say as the five-time Ballon d’Or winner moved into third place on the all-time list of international goal scorers.
Legendary Hungarian striker Ferenc Puskas scored 84 goals while Iran’s Ali Daei leads the list with 109 goals in 149 internationals.
Egypt, back at a World Cup for the first time since 1990, will play in Group A at the finals this summer with hosts Russia, Uruguay and Saudi Arabia.
Portugal are in Group B and will face Spain, Morocco and Iran.
Download our app and read this and other great stories on the move. Available for Android and iOS.