With the exception of McTominay’s bullet header, it felt like the entirety of the first half was played in Scottish territory.
Rafael Leao terrorised the left-hand side, creating five fantastic chances either for himself or a team-mate.
Gunn made two fine saves - one from Leao and another from Liverpool forward Diogo Jota - while watching a few other shots fly inches wide.
Every Portuguese roar made Scotland fans wince but the defence somehow stood firm until the break - battered, bruised and punch-drunk but unbreached.
That was until Portugal's first real chance of the second half.
A tame cutback was somewhat scuffed by Fernandes, but Gunn could only palm into his own net. Another individual error to add to a montage from Scotland's recent performances.
Scotland responded well, though. There were penalty shouts from Billy Gilmour and Ryan Christie - both correctly not given - while McTominay thundered a shot into Diogo Costa's midriff.
That was as good as it got for the visitors, though.
Portugal pushed again, led by Ronaldo. His backheel flick unlocked the Scottish defence and put Felix through on goal, but Gunn made amends with a superb save.
Three minutes later, Felix almost scored again with a diving header but Gunn was there again to deny him. Ronaldo hit a post on the follow-up, hitting the upright again in the next phase of play with a fantastic looping header.
Scotland did not heed the warning.
Mendes' teasing cross evaded Jota at the front post, took out Gunn in the middle and was bundled home by a jubilant Ronaldo - his 132nd Portugal goal celebrated just like his first.