Bruno Fernandes broke the deadlock in the 39th minute and Ronaldo wrapped it up with four minutes left to ensure that Portugal finished second in Group B with 17 points, three ahead of Serbia who drew 2-2 with Ukraine.
Diogo Jota’s shot appeared to be going in any way but Ronaldo prodded it over to claim the goal.
He is one short of joining Iran’s Ali Daei, the only player to have scored a century of goals for a national team.
“I would have been very proud to have scored my first goal for the national team, but the important thing is we won,” said Jota. “It doesn’t matter who scores – we are in the Euros and that is what we wanted.”
Portugal survived several early scares as they struggled to impose their game on a rain-soaked pitch full of divots at the Josy Barthel stadium.
Ronaldo, in particular, was not enjoying the conditions and gestured angrily at the pitch after sending a speculative wide in the first half.
Needing a win to qualify without having to worry about Serbia’s result, Portugal were in trouble early on as Luxembourg saw a chance to spring an upset.
Maurice Deville got above his marker and headed over from Laurent Jans’ cross and Vincent Thill, a thorn in Portugal’s side, had a goalbound shot blocked by Ruben Dias.
Luxembourg were even closer when a corner found Gerons Rodrigues unmarked but he headed over.
Portugal began to adapt to the conditions and their more direct approach was rewarded with a goal.
Bernardo Silva floated a pass over the Luxembourg defence from deep inside his own half and into the path of Fernandes who took it superbly in his stride and fired a low shot between Anthony Moris and the near post.
The second half was more comfortable for Portugal as they dominated possession although there still anxious moments.
Ronaldo nearly sealed it when he curled a free kick narrowly wide from the edge of the area.
With four minutes left, Silva’s cross found Jota and Moris got a hand to it but could not stop it crossing the line and Ronaldo poked it home for good measure.
“We won’t be favourites but we are going there to win,” said Portugal coach Fernando Santos, whose side also won the inaugural Nations League this year.
“We are not the prettiest team but we have won two European tournaments in the last four years.”