Cristiano Ronaldo's Portugal defeated Switzerland 2-0 in Lisbon on Tuesday to earn a place at the 2018 World Cup and consign their opponents to next month's play-offs.
An own goal from Johan Djourou handed the European champions the lead on 41 minutes and Andre Silva netted a second before the hour as Portugal finished top of Group B ahead of Switzerland on goal difference.
Switzerland, who beat Portugal 2-0 at home last year, had won all nine previous qualifiers but must overcome a two-legged play-off in November to earn a fourth straight World Cup appearance.
"We've never pretended to be the best in the world, but we're capable of going head to head against any opponents," said Portugal coach Fernando Santos.
"To lose the first qualifying match, just after our win at Euro 2016, hurt us. But we were able to respond starting with the following match.
"From that point I always thought we had to win all our remaining games because I was convinced the Swiss wouldn't drop any points before coming to Lisbon."
Ronaldo, who was injured for the opening qualifying defeat in Basel, returned to the Portugal line-up after coming off the bench to notch the opening goal in a lacklustre 2-0 win in Andorra on Saturday.
Switzerland were attempting to join defending champions Germany - and Spain ahead of the 2010 finals - as the only nations to complete a European World Cup qualifying campaign with a perfect record.
But AC Milan striker Andre Silva forced Yann Sommer into a smart early save from his deflected shot, with the Swiss goalkeeper then forced to make a terrific stop to tip over Bernardo Silva's venomous effort.
A clumsy challenge in the area on Switzerland forward Haris Seferovic by Benfica team-mate Eliseu went unpunished as the visitors made a rare foray deep into the Portuguese half.
Madonna in the crowd
US pop star Madonna was among the crowd at the Estadio da Luz which erupted when Djourou inadvertently bundled a dangerous cross from Eliseu beyond Sommer four minutes before the break under heavy pressure from Joao Mario.
Xherdan Shaqiri tried to deceive Portugal keeper Rui Patricio with an ambitious free-kick early in the second period, but Portugal doubled their advantage with a brilliant team goal on 57 minutes.
Manchester City midfielder Bernardo Silva exchanged passes with former Monaco team-mate Joao Moutinho, threading through the return pass for an unmarked Andre Silva to steer in at the far post.
Switzerland go into the play-offs as the best of the eight runners-up to advance, with Slovakia missing out as the worst of the nine second-placed sides.
Vladimir Petkovic's team will be among the seeded countries for the play-off draw on October 17 and could face Sweden, Northern Ireland, the Republic of Ireland or Greece for a place at Russia 2018.
"We took a step backwards but we have to stay positive," said Petkovic. "In November we will take two steps forwards.
"I haven't had time to analyse our potential opponents, but I know they all have competitive teams."