If that gave the Spanish club confidence, they were left in an even stronger position when Porto had Steven Defour sent off for a second booking shortly after the restart.
And substitute Roque Santa Cruz scored the crucial goal, heading home with 13 minutes left, as Malaga, making their first appearance in the competition, become the third club from La Liga in the quarter-final draw, along with Real Madrid and Barcelona.
“It really has been a strange year for us,” said Malaga coach Manuel Pellegrini, with the Spanish club having made just as many headlines for their off-field financial problems as for their European success.
“What characterises the players is their desire to stay focused on their sporting ambitions. I always said that Malaga were not in the Champions League just to make up the numbers,” added the Chilean, who took Villarreal to the semifinals in 2006.
“It would be good to avoid another Spanish team in the quarters, but we will take whatever the draw gives us.”
Malaga had not won a domestic game since losing the first leg in Portugal, and they took their time to come out on top in the contest.