The Portuguese side went ahead early on through a Ricardo Quaresma penalty, after Manuel Neuer tripped striker Jackson Martinez in the box.
Winger Quaresma then dispossessed Dante before running through on goal and calmly slotting a second into the net.
Thiago pulled a goal back for Bayern, but Martinez grabbed a brilliant third. The return leg takes place on 21 April.
Porto hold a significant advantage in the tie as they aim to reach their first semi-final since winning the competition in 2004 under Jose Mourinho.
Their performance was built on hard work and pressure, before moving the ball quickly to the front, but they were helped by shambolic defending from Bayern.
The Germans - who boasted an 11-game unbeaten run in Portugal - managed to claim an away goal, but missed key players including wingers Franck Ribery and Arjen Robben, as well as midfielder Bastian Schweinsteiger.
Porto boss Julen Lopetegui and Bayern's Pep Guardiola played together at Barcelona in the 1990s, and 48-year-old Lopetegui's tactics were spot on at Estadio do Dragao.
The ex-Real Madrid Castilla man deployed a high-intensity pressing game, giving his former team-mate's side little time on the ball.
And it worked instantly as Bayern went behind after three minutes. Midfielder Xabi Alonso was caught in possession by the returning Martinez - playing after six weeks out with a groin injury - who attempted to round goalkeeper Neuer but was brought down.
The German received only a yellow card, as the Colombian front man had been running away from goal, and Quaresma dispatched the penalty.
Minutes later, former Barcelona and Inter Milan man Quaresma doubled the lead after nicking the ball from Dante, before keeping his composure to stroke home.
The visitors reduced the deficit through Thiago, who swept home Jerome Boateng's cross, but Martinez's beautifully taken third with instant control and cool finish - after the ball sailed over Boateng's head - leaves the five-time winners with much to do in the second leg.
Porto manager Julen Lopetegui: "It was fundamental that we tried our best to impose ourselves on Bayern and not give them a chance to settle.
"We are facing one of the strongest Bayern teams in history. The hardest part will be in Munich.
"We will need to produce a perfect performance in Germany next week to progress."
Bayern Munich manager Pep Guardiola: "There's still another leg. We're a bit upset but we have six days to analyse it.
"We have players who were out a long time with injuries - their legs don't last very long,"
"It's a tough result to take into the second leg, but we'll give it a go."
Porto shocked Bayern Munich to take a first-leg lead in an entertaining Champions League quarter-final tie.