Sadio Mane scored a hat trick and Mohamed Salah and Roberto Firmino provided the other two goals to give the Premier League side a huge advantage ahead of the second leg at Anfield on March 6.
"It was hard work, but in the end the boys enjoyed it," Liverpool coach Juergen Klopp said after the clubs first appearance in the knockout stage of the Champions League for almost nine years.
"I saw a lot of fantastic performances tonight and a result like this is only possible if everyone is really at the top of their game," Klopp said.
Liverpool is the top-scoring side in the competition with 28 goals.
More From This Section
"We knew we were facing a great team but we werent expecting this," said Porto defender Alex Telles, whose team was without injured midfielders Danilo Pereira and Andre Andre. Striker Vincent Aboubakar was also out with a muscle problem.
A mistake from Porto goalkeeper Jose Sa allowed Manes shot to squirm under his body after a slow start from the visitors, and Salah displayed all his class to make it 2-0 four minutes later inside the first half-hour.
It was the African player of the years sixth goal in the competition, and his ninth in eight games across all competitions.
The home side showed promise after the break but was caught on a counterattack when Sa saved Firminos effort, only to push the ball toward Manes feet. The Senegal striker needed no second invitation for his second goal.
Sa was playing in place of Iker Casillas, dropped earlier this season after falling out of favour with Porto coach Sergio Conceicao, who must have been reconsidering his decision after a shaky performance from the 24-year-old Sa.
Firmino got the goal his performance deserved with a simple finish inside the left post from Milner's cross with 20 minutes remaining, and Mane took advantage of some lax defending to seal the win with a fine strike from distance late on.
"We needed to play as a team and that's what we did," Mane said after his first hat trick for Liverpool. "We played great football, created great chances and scored five goals. I enjoyed the fifth goal the most." Casillas's former side, Real Madrid, came from behind to beat visiting Paris Saint-Germain 3-1 in the other Champions League game today.