Alex Telles scored an extra-time penalty following a VAR review to send Porto through to the Champions League quarter-finals at the expense of Roma.
Alessandro Florenzi was penalised for dragging Fernando back when the ball was fizzed across the goal in the 116th minute and Telles emphatically converted from the spot.
Porto’s Moussa Marega took the game to extra time when he got on the end of Jesus Corona’s curling cross.
Roma captain Daniele de Rossi had earlier cancelled out Francisco Soares’ opener for Porto in the first half.
It is the first time the Portuguese club have reached the quarter-finals since 2014-15.
The draw for the quarter-finals takes place on Friday, 15 March.
Porto fight back on magical night
At 19 years and 225 days, Nicolo Zaniolo became the youngest Italian to score twice in a Champions League game to put Roma in control of the tie with a 2-1 victory in the first leg.
But Porto were unlikely to go down without a fight and they were the better team for large parts of the return leg in Portugal.
Corona set the tone when his half-volley flew over the bar within four minutes while Telles smashed a powerful effort into the side netting moments later.
Then after Kostas Manolas lost the ball on the halfway line, Porto’s ruthless counter-attack ended with an easy tap-in for Soares after Marega’s inviting cross.
That goal gave Porto the advantage in the tie – thanks to Adrian Lopez’s away goal in the first leg – but it woke Roma from their slumber.
Last season’s Barcelona conquerors lifted their intensity and were rewarded when Eder Militao brought down Diego Perotti to hand De Rossi an opportunity from the spot.
The Roma captain showed his class when he deceived veteran keeper Iker Casillas with a strike into the bottom left corner but he ended the half limping off with an injury.
Roma missed his presence in the second half as Porto searched for the goal that would take the game to extra time.
Soares’ diving header bounced off the turf and over the bar but it was a brief reprieve for the visitors as Corona’s curling cross was smashed in at the back post by Marega within seven minutes of the restart.
The drama continued until the 90th minute as Felipe and Yacine Brahimi went close for Porto while Roma striker Edin Dzeko dragged his shot wide.
The former Manchester City forward almost broke the deadlock in extra time too, blasting over from close range after 110 minutes, before Pepe was forced to make a goalline clearance to keep Dzeko’s chip out.
Fernando then fell in the box after his shirt was pulled by Florenzi as the ball was played across goal, and referee Cuneyt Cakir awarded a penalty after using VAR.
Telles kept his cool to fire Porto into the quarter-finals with a result that means legendary keeper Casillas has now won more games than any other player in Champions League history.
What next for Roma’s boss?
There was speculation surrounding the future of Roma boss Eusebio di Francesco heading into this last-16 tie.
Reports in Italy suggested the 49-year-old could be sacked if he lost after Roma were defeated 3-0 by derby rivals Lazio on Saturday, leaving them three points adrift of a top-four place in Serie A.
Chelsea manager Maurizio Sarri is one of several managers who has been linked to replace him – although the Italian has dismissed the claims.
Just 10 months ago, Di Francesco guided Roma to the Champions League semi-finals – where they were knocked out by Liverpool – and saw them produce one of Europe’s greatest comebacks against Barcelona en route.
But since then, Roma have seen key players leave the club as Brazil goalkeeper Alisson joined Liverpool in a £67m deal, midfielder Radja Nainggolan left for Serie A rivals Inter Milan and Kevin Strootman joined French club Marseille.
With Roma’s season now hanging by a thread, this latest defeat could prove ultimately costly for Di Francesco.
Man of the match – Moussa Marega (Porto)
Leaving it late – the best of the stats
- Porto advanced from a two-legged tie in the Champions League after losing the first leg for the first time since 1986-87, when they beat FC Vitkovice in the last 16 of the European Cup (3-1 on aggregate).
- Roma have lost each of their past eight Champions League knockout games away from home.
- Telles’ penalty (116 mins, nine seconds) was the latest to be scored in a Champions League match since Cristiano Ronaldo against Atletico Madrid in the 2014 final (119 mins, 52 seconds).
- Marega became just the second African player to score in six consecutive Champions League appearances, after Marouane Chamakh in October 2010.
- Soares’ opener was Porto’s 250th goal in the Champions League, making them the eighth team in the competition to reach the milestone.
- Roma have conceded in each of their past 31 away games in the Champions League – the longest streak in competition history