Alex Telles scored a match-winning penalty with three minutes of extra-time remaining as Porto beat Roma 3-1 to clinch a 4-3 aggregate victory and progress to the quarter-finals of the Champions League.
Roma took a 2-1 lead into the second leg after an uninspiring victory at Stadio Olimpico but Porto levelled the last-16 tie when Tiquinho Soares scored from close range to put the hosts ahead on the night.
Daniele De Rossi struck from the penalty spot but Moussa Marega made it 2-1 early in the second half before Wednesday's game petered out and went into extra-time.
A penalty shoot-out looked imminent until Alessandro Florenzi's shirt pull on Fernando prompted a VAR consultation and, after referee Cuneyt Cakir pointed to the spot, Telles stepped up to send Estadio do Dragao into raptures as Porto reached the last eight for the first time in four years.
The result puts Roma coach Eusebio Di Francesco's future in doubt, with the club outside the top four in Serie A having suffered a derby defeat to Lazio last time out and no longer in contention for any silverware.
Porto, meanwhile, are the first Portuguese club to defeat Italian opposition in the Champions League since 2005 and Sergio Conceicao's men can continue to dream of European glory while pushing for the Primeira Liga title.
Porto deservedly levelled the tie after 26 minutes when Kostas Manolas, making his 200th Roma appearance, was dispossessed in midfield and the hosts poured into the box where Marega's cross beat goalkeeper Robin Olsen and Soares side-footed into the empty net.
But Roma restored their overall advantage after Diego Perotti was brought down on his way into the box by Eder Militao and De Rossi sent Iker Casillas the wrong way with his spot kick after staggering his run up.
Lorenzo Pellegrini replaced the struggling De Rossi at the end of the first half and Soares sent a diving header narrowly over as Porto sought to level the tie at 3-3.
Olsen then made a good save at full stretch from Marega but there was nothing the goalkeeper could do when the same player applied a volleyed finish to Corona's in-swinging cross, lifting the ball high into the net with his instep from point-blank range.
Perotti was guilty of a glaring miss, hooking wide from 12 yards when allowed to run through on goal unchallenged, before the second half ground to a halt with both sides reluctant to get caught on the break.
Marega lashed a shot over early in extra-time but chances were few and far between until Edin Dzeko missed two in quick succession as the hosts began to tire.
But substitute Maxi Pereira piled forward in the 117th minute and flashed the ball across the face of goal where it was deemed Fernando had his shirt pulled by Florenzi.
Telles made no mistake, slamming the penalty into the left side of the net and clinching a historic victory.
What does it mean? Di Francesco in trouble
Roma, semi-finalists last season, are a club that demands success and Di Francesco does not look likely to achieve it this season. He might be out of a job before Porto find out who they face in the quarter-finals on March 15, in a season that also saw them lose 7-1 to Fiorentina in the Coppa Italia.
Danilo the difference
Danilo Pereira was a constant thorn in Roma's side, refusing to allow the visitors an inch in midfield as he inspired Porto's turnaround. Incredibly, he finished the match with passing accuracy of 100 per cent.
Dzeko shirks the battle
Pepe led Porto's attempts to unsettle Dzeko and it worked, the Roma talisman reduced to play-acting in attempts to win free-kicks while possession eluded him. He struggled in front of goal, shooting on target just once from six attempts.
KEY OPTA FACTS:
- Porto have advanced from a two-legged tie in the European Cup/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.
- Telles' penalty for Porto (116:09) was the latest to be scored in a Champions League match since Cristiano Ronaldo v Atletico Madrid in the 2014 final (119:52).
- Marega became just the second African player to score in six consecutive Champions League appearances, after Marouane Chamakh in October 2010.
- De Rossi became Roma's second-oldest scorer in the Champions League (35y 225d), after Francesco Totti in November 2014 (38y 59d v CSKA Moscow).
- Roma have conceded in each of their last 31 away games in the Champions League – the longest streak in competition history.
Roma entertain Empoli in a must-win Serie A fixture next Monday, while Porto's league title bid continues when they travel to Feirense on Sunday.