Cristiano Ronaldo's last-gasp double denied Mohamed Salah and Egypt victory as Portugal instead snatched a dramatic 2-1 friendly win in Zurich.
The Real Madrid star had been frustrated for long periods in a largely drab contest as Egypt's own leading light Salah looked to have taken the scalp of the European champions.
But a pair of stoppage-time headers from Ronaldo – the second allowed only after conference with VAR – turned the game on its head and showed just why Portugal cannot be written off ahead of the World Cup.
Fernando Santos' men looked to be down and out, running out of ideas after the in-form Salah – enjoying a stunning 36-goal season with Liverpool – struck early in the second half.
Chances just were not falling for Ronaldo, but what seemed to be one last rally resulted in a scrappy effort to level the scores and Portugal quickly sought the winner that arrived from the head of their 33-year-old talisman.
While Santos should still have concerns after a directionless display for the most part, Ronaldo's stunning form in 2018 is enough to ease most worries, his brace making it 23 for the year for club and country.
Portugal started on the front foot, but it was their own goalkeeper Beto who made the first meaningful save, springing into action to block from Abdallah El Said after Trezeguet teed up a shot 10 yards from goal.
Santos' side continually failed to exploit a rudimentary Egypt back-line in the opening 20 minutes, with Ahmed Hegazi brilliantly reeling in Andre Silva just as a shoddy offside trap looked to have finally allowed the forward through.
Bizarre circumstances led to Ronaldo's first opening as Ahmed Fathy needlessly nudged the ball into the hands of goalkeeper Mohamed El-Shenawy for a backpass, but the Ballon d'Or winner's indirect free-kick was blocked instinctively on the line by El Said.
And a very tight offside call denied Portugal shortly before half-time, Rolando seemingly straying beyond the last man before nodding home Silva's flick-on from a corner.
Salah had found little joy in the opening period, but he abandoned his right-wing posting after the restart and swiftly made an impact, sweeping a 20-yard finish inside Beto's near left-hand post to stun the European nation.
Portugal redoubled their efforts and Ronaldo's left-footed drive drew a save from El-Shenawy, before Raphael Guerreiro sent a volley dipping narrowly over the top.
The improving El-Shenawy saved twice more as substitutes Ricardo Quaresma and Bruno Fernandes went for goal but, just as Portugal looked to be running out of ideas, Ronaldo came to the rescue.
He nodded Quaresma's left-wing cross past the scrambling goalkeeper and then quickly added a second, powering in a centre from the same team-mate on the opposite flank.
A bizarre pause followed as the referee appeared to disallow the goal despite the absence of an obvious foul, Ronaldo finally able to celebrate after the video had been consulted to bring a close to a hectic second half.