The Portuguese side exploded into action with two goals in the opening 10 minutes, with Quaresma converting from the penalty spot and finishing neatly as Bayern's sluggish defending was punished.
Five-times champions Bayern, decimated by injuries, clawed their way back into the tie when midfielder Thiago Alcantara steered home at the far post after 28 minutes.
But Martinez pounced on an error by Jerome Boateng after 65 minutes and rounded Bayern keeper Manuel Neuer to re-establish Porto's two-goal advantage heading into the return leg on April 21.
Bayern came into the game, a repeat of the 1987 European Cup final which Porto won 2-1, ravaged by injuries and robbed of the services of Arjen Robben, Franck Ribery, Bastian Schweinsteiger and David Alaba among others.
It was, however, a different story for Porto, who welcomed back Martinez from a hamstring injury.
The Colombia striker wasted little time in making his mark, robbing a dawdling Xabi Alonso of the ball on the edge of the Bayern box before being felled by Neuer's outstretched leg.
The Bayern keeper was perhaps lucky to receive just a yellow card, but his punishment was swiftly increased as Quaresma stepped up to stroke the penalty into the bottom corner.
There was no time for the visitors' nerves to settle as Quaresma pounced on another mistake, robbing Dante before dashing through and beating Neuer with an expertly-taken finish with the outside of his boot to make it 2-0 after 10 minutes.
It looked like Bayern could be on the end of an embarrassing scoreline as the hosts' slick passing was cutting through at will.
But the Germans clawed a goal back on 28 minutes when Boateng's low cross from the right escaped both Danilo and Bruno Martins Indi to reach Alcantara, who slotted home coolly past Porto keeper Fabiano.
As the excitement rose in the second half, Porto managed to maintain their impressive energy levels and took the game to Bayern once again.
The visitors were grateful to Neuer for pulling off a stunning fingertip save early in the second half to prevent Boateng scoring an own goal, before Porto took a well-deserved and potentially decisive 3-1 lead.
Bayern's dismal defending cost them again when Boateng failed to deal with a high ball and Martinez stole in to round Neuer and sidefoot home.
An increasingly fraught second half was littered with yellow cards and bookings for Porto's first-choice full backs Danilo and Alex Sandro ruled them out of the second leg in Munich. – Reuters
Original source: Quaresma’s double sinks Bayern