Porto sealed top spot in Champions League Group D as two quickfire second-half goals helped them overcome Schalke 3-1.
Though both sides were certain of their places in the last 16 thanks to Galatasaray's earlier defeat at Lokomotiv Moscow, Porto knew that a victory would secure pole position with a game to spare.
And despite goalkeeper Ralf Fahrmann's best efforts, Porto took control when Eder Militao headed home his first goal for the club in the 52nd minute and Jesus Corona made it two three minutes later.
With the crossbar denying Felipe a fluke goal, Nabil Bentaleb's late penalty set up a grandstand finish, but Moussa Marega's stoppage-time strike wrapped up the win.
That moved Sergio Conceicao's men on to 13 points, their only misstep in five group-stage games coming in the opening 1-1 draw with Schalke.
Fahrmann shone in the reverse fixture on matchday one and was at his best to keep out Danilo Pereira's rasping 15th-minute shot.
Schalke had their captain to thank once more four minutes later, Marega's curling effort forcing Fahrmann into a wonderful diving save to his left.
Hector Herrera squandered a great chance moments after the restart, but Porto were not to be denied for much longer – Militao rising highest to plant in a powerful header from Oliver Torres' cross.
Fahrmann was beaten again three minutes later, Corona exchanging passes with Yacine Brahimi before slotting into the bottom-left corner with the help of a deflection.
Felipe's audacious overhead kick almost stole the show, only for the woodwork to come to Schalke's rescue.
Torres' handball handed Schalke a lifeline, but Bentaleb's coolly taken penalty proved a mere consolation, with Marega's fourth Champions League goal of the season making sure of the points.
What does it mean? Porto, Schalke can take it easy
There is nothing to play for now at the top of Group D, meaning that both coaches will have the luxury of resting their star players should they wish when matchday six rolls around. Porto face a trip to Galatasaray, while Schalke host Lokomotiv on December 11.
Fahrmann proves a thorn in Porto's side
Fahrmann starred with a series of superb saves – including one from a penalty – in Schalke's 1-1 draw with Porto in September, and although they ultimately proved fruitless, the 30-year-old demonstrated his quality with a string of brilliant stops. Porto may well be glad to see the back of him.
Defensive collapse a concern for Tedesco
Although they relied on Fahrmann, Schalke's defensive solidity was certainly a factor in frustrating Porto in the first half, but as soon as Militao found the net, the visitors' resolve disappeared, and Domenico Tedesco must work to improve that if the Bundesliga side are to make the most of their chance in the knockout stages.
Key Opta Facts
- Porto qualified for the Champions League knockout stages for the third consecutive season.
- Despite their defeat, Schalke sealed their first qualification for the Champions League knockout stages since 2014-15.
- Porto have won four consecutive games in the Champions League for the first time since October 1996.
- Porto striker Moussa Marega is the first player to score in four consecutive Champions League games for the club since Mario Jardel, who netted in five in a row in 1999.
- Porto's Jesus Corona has scored in each of his last three Champions League games, after netting just one goal in his first 21 appearances in the competition.
Primeira Liga leaders Porto will look for a fourth successive league win when they take on struggling Boavista on Sunday, a day after Schalke travel to Hoffenheim in the Bundesliga.