Martinez had earlier won the penalty from which Ricardo Quaresma netted Porto's opener on Wednesday, before the Portugal midfielder doubled his tally as the home side went 2-0 up inside 10 minutes at Estadio do Dragao.
Thiago Alcantara did pull one back for Bayern, but Martinez's well-taken effort midway through the second half gave Porto a healthy advantage to take into next week's return leg at the Allianz Arena.
"These were a couple of difficult weeks for me, as I did not knew if I would be able to play," Martinez said.
"It is never easy when we return after an injury, but I prepared myself for this moment and everything went great.
"I'm still not 100 per cent fit but with the help of my team-mates I was able to take this effort.
"We knew Bayern are fantastic with the ball and that they would have more possession than us, so we had to pressure them high on the field and not concede spaces in the middle.
"And then we were able to make the most of the chances we created."
Porto's captain Martinez cautioned his side, though, that the job is not done yet.
"This win fill us with joy, but we know that it does not define who will go through to the next round," he added.
"We still have to play another match, that will be much harder then this one."
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1