Thiago Alcantara, Jerome Boateng, Thomas Mueller and Xabi Alonso also got goals for five-time champion Bayern, which advanced on 7-4 aggregate in the home-and-home, total-goals series.
"It's easy to love my players now," Pep Guardiola said after his 100th game with Bayern. "I am the coach of extraordinary players. I didn't expect such a first half."
In the night's other match, Neymar scored in the 14th and 34th minutes, and Barcelona beat visiting Paris Saint-Germain 2-0 for a 5-1 aggregate win. Barcelona, a four-time champion, is in the semifinals for the seventh time in eight seasons.
Despite missing injured stars Arjen Robben and Franck Ribery, Bayern applied pressure from the opening whistle and by midway through the first half had wiped out Porto's 3-1 advantage from the first leg.
Lewandowski scored from Philipp Lahm's cross in the 27th, Thomas Mueller got a goal on a shot that deflected off Bruno Martins in the 36th and Lewandowski made it 4-0 in the 40th.
Jackson Martinez scored for Porto, which finished the match a man short following Ivano Marcano's 87th-minute ejection. Alonso completed the rout in the 88th.
"It was wonderful. It couldn't have gone better," Mueller said. "We never thought we could play such a first half."
At Barcelona, Andres Iniesta made a solo run through the defence to set up the opening goal by Neymar, who scored his second off a cross from Dani Alves. Neymar has 30 goals, combining on an attack that includes Lionel Messi (46 goals) and Luis Suarez (19).
"I don't want to look too far ahead, but I hope the best is yet to come," said Luis Enrique, who with 42 wins became the Catalan club's most successful coach through his first 50 matches. "That's what my players have been playing for this season, to be in the position to win titles."
Real Madrid hosts Atletico Madrid on Wednesday following a 0-0 tie in the first leg, and Juventus is home with a 1-0 lead against Monaco.Suggest a correction