Cristiano Ronaldo took his tally of international goals to 99 with a late tap-in as Portugal secured a place at Euro 2020 with a laboured 2-0 win over Luxembourg.
Ronaldo fell just short of becoming the second player in history to reach a century for his country after Iran's Ali Daei on an afternoon when he struggled on a slow pitch at Stade Jose Barthel, where the reigning European champions were made to work hard for the victory.
The creative endeavour of Bernardo Silva proved more of a threat than Ronaldo's presence and it was the Manchester City playmaker who teed up Bruno Fernandes to break the deadlock late in the first half of Sunday's Group B clash.
Thereafter Portugal offered little and those gathered at Stade Josy Barthel to see Ronaldo make history were instead treated to an impressive display from a side ranked 96th in the world by FIFA, but the Juventus talisman did manage to score from practically on the line with four minutes remaining.
Ronaldo gave Anthony Moris an easy save with a tame shot from 12 yards early on but it was not all one-way traffic, with Danilo Pereira and Fernandes leaving gaps in midfield that allowed Luxembourg to attack.
Maurice Deville and Gerson Rodrigues both headed narrowly over the crossbar and the hosts deserved credit for restricting Portugal's first-half chances, although they were powerless to stop Fernandes' opener.
The Sporting CP star deftly controlled Silva's weighted pass six minutes from half-time before putting his laces through the ball, hammering a shot into the bottom corner of Moris' net.
Jose Fonte headed just wide early in the second half but it was the hosts who played the better football without creating a clear scoring opportunity.
Fernandes was brought down by Olivier Thill with 13 minutes left, presenting Ronaldo with a free-kick on the edge of the box, but Portugal's all-time leading goalscorer blazed wide with an effort that looked set to sum up his afternoon.
That was until Moris parried Diogo Jota's effort from a Bernardo cross and Ronaldo helped the ball over the line to ensure his name was on the scoresheet.
What does it mean? Santos' men struggle for consistency
Portugal coach Fernando Santos can be pleased with his side's record of five wins, two draws and one defeat in qualifying, but after seeing them hammer Lithuania 6-0 on Thursday this performance offered a reminder of their occasional lack of fluency.
Bernardo copes with the quagmire
While Ronaldo under-hit passes and snatched at chances, Bernardo kept his composure to steer Portugal to victory, never more so than when he floated an exquisite pass to allow Fernandes to score.
Danilo off the pace
Luxembourg were not expected to make a close game of this but they found space in an around Portugal's box that a player of Danilo's quality should have been dominating.
European Championship holders Portugal will be among the favourites at Euro 2020 with a coach who knows how to win it at the helm in Santos, while Luxembourg's impressive performance in this game will have done Luc Holtz's chances of remaining in charge no harm.