Cristiano Ronaldo became international football's record goalscorer with a last-gasp double to snatch Portugal an unlikely victory from the Republic of Ireland's grasp.
The 36-year-old celebrated his return to Manchester United in style by almost single-handedly rescuing the Portuguese with headers in the 89th minute and the sixth minute of stoppage time to make it 2-1 just as it looked as though Ireland had opened their Group A account with a famous win.
Ronaldo had earlier seen his first-half penalty saved by 19-year-old keeper Gavin Bazunu before John Egan headed the visitors into the lead seconds before the break.
But just as Stephen Kenny dared to believe a first competitive win of his reign at the 10th attempt was coming his way, Ronaldo eclipsed the 109-goal record he shared with Iran's Ali Daei and then took his tally to 111 to turn the game on its head.
The final score was desperately harsh on Ireland, who have now played three qualifiers and still do not have a point to their name despite their most impressive performance yet under Kenny.
Kenny had asserted in advance that simply defending would be unworkable, but his side found themselves with little option in the early stages and they almost paid for it when Jeff Hendrick was adjudged to have brought down Bruno Fernandes inside the penalty area and referee Matej Jug pointed to the spot.
Having been advised to review the incident at length, the Slovenian stuck to his original decision handing Ronaldo an early chance to pass Daei's mark, but a superb save by Bazunu as he dived to his right dashed his hopes.
Ronaldo's miss did little to change the pattern of the game as a star-studded Portugal team conducted by Fernandes probed away with increasing penetration, Diogo Jota heading against a post from Joao Cancelo's 28th-minute cross with Bazunu helpless and Fernandes curling an effort over with 10 minutes of the half remaining.
In the meantime, Kenny had been forced into a reshuffle by an injury to Dara O'Shea which prompted him to hand a senior debut to Norwich defender Andrew Omobamidele, although the newcomer arrived with the visitors growing into the game and starting to prosper on the counter attack.
They might have taken the lead when Aaron Connolly got in behind the Portugal defence, only to see his attempt blocked by keeper Rui Patricio.
But they did just that on the stroke of half-time when Egan rose ahead of Ronaldo to glance Jamie McGrath's corner across Patricio and inside the far post.
Ireland returned from the break anticipating an onslaught and they were not to be disappointed, but their impressive organisation remained admirably intact to repel wave after wave with little real difficulty.
Bazunu was sent scrambling anxiously across his goal as Fernandes' 55th-minute strike arced agonisingly wide of his far post, but the visitors were appealing in vain for a penalty four minutes later with Connolly adamant he had been barged to the ground by Joao Palhinha as he fired wide Egan's knock-down.
Portugal turned the screw as time ran down and seemed certain to level with 16 minutes remaining when Bernardo Silva collected the ball beyond the far post and stepped inside on to his left foot only to blaze high over.
Bazunu kept out Ronaldo's 89th-minute free-kick to edge the Republic ever closer to victory, but there was nothing he could do to keep out his header seconds later as he climbed to meet substitute Goncalo Guedes' cross.
There was to be a further twist, however, and inevitably it was Ronaldo who was on hand to plant home a second header and snatch victory in the sixth minute of stoppage time.