Ronaldo, appearing in his 900th career match, made his mark to devastating effect as time ran out at the Letzigrund Stadium in Zurich.
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 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.
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, it was Ronaldo who had the final say in the battle of the titans in Zurich on Friday.