The home side were at times in control during the early stages of the first half, especially after Silvestre Varela's opener, but City rallied to level through a fortuitous own goal from Alvaro Pereira before Sergio Aguero netted a late winner from the edge of the six-yard box.
The result gives Roberto Mancini's men a slight advantage going into the return leg at the Etihad Stadium next week where they will be firm favourites to progress to the next phase of Europe's second tier competition.
Porto were doing their fair share of attacking and it paid dividends in the 27th minute when Varela got on the end of a clever low cross from Hulk on the left side of the area to finish after getting past Gael Clichy with the ball finding its way into the back of the net off Joe Hart's legs.
Just under 10 minutes into the second half, City got back on level terms when Yaya Toure sent a clever ball into the area directed at Mario Balotelli but Pereira got their first and crashed into the Italian whilst making contact with the ball at the same time and seeing it rocket past Helton for a disastrous own goal.
With about five minutes remaining, after a very slow section of the contest, City managed to get a goal ahead when Tour advanced into the area before cutting back for substitute Aguero who could not miss with his side-footer from close range to give the English league leaders' Europa League campaign genuine momentum.
Both keepers were relatively busy, especially Porto's Helton, who came up with three brilliant saves in the first half, denying Micah Richards' long range attempt before a similar stop at the near post from Samir Nasri's effort. The Brazilian was then able to thwart Mario Balotelli who sent a bullet goalward from just outside the area.
In the 15th minute, Porto went extremely close to an opener when Rolando got on the end of a short corner and powered his header into the ground with Gael Clichy able to guide it safely over the crossbar.
Another close call came in the 50th minute when City right-back Richards was unlucky to be denied by the upright after he charged past Pereira to get a fierce shot off.
It seemed like neither side wanted to win the contest as the game progressed with the sting going out of proceedings prior to City pushing for the late winner which puts them in command for their home leg.
UEFA Europa League Round of 32 - first leg
Estadio do Dragao, Porto