Porto, who started the day second in the group behind already-qualified Liverpool, wasted numerous first-half opportunities and were made to pay a heavy price.
Their record against Liverpool now stands at played 10, drawn three and lost seven.
Liverpool, with the likes of Virgil van Dijk and Jordan Henderson rested, went ahead through Thiago's stunning low strike in the 52nd minute before Salah made the points safe with a clinical finish in the 70th.
"So many good things happened tonight, players got minutes, rhythm, confidence, nobody got hurt," Liverpool coach Jurgen Klopp said. "Thiago's goal... wow!"
Porto host Atletico (four) in their final match in the group with Milan (four) hosting Liverpool.
"People might be surprised with Tyler Morton but he did exceptionally well," Klopp said. "He is a good player and really pleased for him that he put a performance in like this."
Yet Liverpool failed in the first half in which Porto were the better side.
Evanilson then had a shot blocked by Ibrahima Konate but Porto's best chance arrived when Colombian Luis Diaz raced away and squared for Otavio who sliced horribly wide under pressure from Kostas Tsimikas.
"We probably had the best of the first half, we created three or four chances and defensively we were disciplined," Porto coach Sergio Conceicao said.
"But then the individual quality of Liverpool players and our lack of offensive effectiveness made the difference. We were not efficient enough tonight.
"But I always said that the group would be decided in the final game and we can still get to the round of 16."
Liverpool occasionally changed gear and thought they had gone ahead when Thiago's pass split the Porto defence and Sadio Mane ran through to score. However, his celebrations on his 50th European game for Liverpool were cut short by a VAR check which showed he had been fractionally offside.
Conceicao was then furious before halftime as Taremi bizarrely opted to try to pick out a team mate when he had the chance to test Alisson.
The chances kept arriving for Porto at the start of the second half with Mateus Uribe's shot on the turn flashing past the post and they were soon to regret their profligacy.
In the 52nd minute Alex Oxlade-Chamberlain's free kick was headed out and Thiago met a bouncing ball with the sweetest of low strikes with the outside of his right foot from the edge of the area to send the a skimming shot past keeper Diogo Costa.
Salah then combined with substituite Henderson before cutting in from the right and beating Costa with a left-foot shot for his sixth goal so far in the group stage.
"It would be good to go through with all wins to take forward into the competition," Alex Oxlade-Chamberlain said. "Everyone dreams of playing at the San Siro in the Champions League, away at Milan and that is what we are here to do."