Francisco Soares and Moussa Marega scored for the hosts in regular time, while Daniele De Rossi converted a penalty for Italian side to left the tie all-square after 90 minutes.
Bosnian striker Edin Dzeko then squandered two goal-scoring opportunities seconds apart in extra-time, before Alex Telles made no mistake with the second spot kick of the game to send Porto through to the last eight.
Elsewhere on Wednesday night, Manchester United defeated Paris Saint-Germain 3-1 at the Parc des Princes to become the first side ever to recover from a 2-0 home defeat in the UEFA Champions League knockout stages.
Marcus Rashford converted a 94th minute penalty, given after referee Damir Skomina consulted the Video Assistant Referee and decided that Presnel Kimpembe had handled the ball inside the box.
Earlier during the game, Romelu Lukaku took advantage of Paris Saint-Germain’s two defensive blunders, while Juan Bernat’s tap-in in the 12th minute of the game kept hosts seemingly in control of the tie.