Cristiano Ronaldo was left in tears when he saw his 115th minute penalty saved by Slovenia goalkeeper Jan Oblak.
However, the experienced forward redeemed himself in the shootout, scoring one of three penalties as Diogo Costa made three crucial stops to send his country through to the quarter-finals.
Here, Sports Mole provides an in-depth analysis of the contest, including highlights, man of the match and the best statistics from a gripping last-16 tie.
HIGHLIGHTS
13th min: A let-off for Slovenia as Bernardo Silva sends an inswinging cross towards Bruno Fernandes at the far post, but the teasing delivery just evades the outstretched Manchester United midfielder.
31st min: Ronaldo fails to make a meaningful connection with his attempted header, allowing Oblak to comfortably gather in the Slovenian goal.
34th min: Close from the Portuguese icon. Ronaldo rifles one of his trademark free-kicks over the crossbar.
44th min: A warning shot from Slovenia as Benjamin Sesko winds up a long-range strike to force Costa into a rare moment of action.
45+2 min: Upright rattled! Joao Palhinha runs onto Rafael Leao's neat cutback before drilling a low shot against the outside of the post.
HALF TIME: PORTUGAL 0-0 Slovenia
47th min: Joao Cancelo showcases his nimble footwork to drive into the box, and before his cross breaks to Silva, who fails to hit the target with a wild left-foot strike.
55th min: Ronaldo threatens with another free-kick. The 39-year-old takes a deep breath before running up to unleash another thumping effort, forcing Oblak to beat the ball away from danger.
62nd min: The Slovenian gameplan nearly bears fruit as Sesko wins the footrace with Pepe to break into the box, but he fluffs his lines at the crucial moment, dragging his left-foot shot harmlessly wide of Costa's goal.
72nd min: Ronaldo is back standing over another free-kick. This one is a little further back than his previous effort, and it proved to be an anti-climatic one as he lashes the ball over the crossbar.
89th min: A late chance goes begging as Ronaldo latches onto Diogo Jota's well-weighted through ball, but he can only fire the resulting shot straight at the grateful Oblak.
FULL TIME: PORTUGAL 0-0 SLOVENIA
100th min: First real sight of goal in extra time. Jota sends a tame header at Oblak after rising to meet Francisco Conceicao's headed effort.
105th min: What drama! Ronaldo misses from the spot! The referee awards a penalty after penalising Vanja Drkusic for a foul on Jota. Ronaldo steps up to see his spot-kick brilliantly saved by Oblak.
108th min: Buoyed from his penalty stop, Oblak makes another smart save to tip the ball over from Pepe's header.
115th min: Sesko spurns the chance to win it. A mistake from Pepe allows the RB Leipzig forward to run through on goal, only for Costa to make a crucial save to deny Slovenia a dramatic winner.
FULL TIME IN EXTRA TIME: PORTUGAL 0-0 SLOVENIA
Penalty Shootout: Ronaldo, Fernandes and Silva all convert from the spot, while Costa denies Josip Ilicic, Jure Balkovec and Benjamin Verbic.
Portugal win 3-0 on penalties
MAN OF THE MATCH - DIOGO COSTA
Costa was a mere spectator for the majority of the contest, making just two saves in 120 minutes of gripping action.
However, one of those stops proved to be pivotal as Costa showcased his quick reactions to prevent Sesko from winning the game in the 115th minute.
The Porto goalkeeper then backed up that important intervention by making three more saves in the penalty shootout to end Slovenia's memorable journey and send his country through to the quarter-finals.
STANDOUT MOMENT
It will be a penalty that Ronaldo will want to forget, but his penalty miss will go down as one of the most dramatic moments of Euro 2024.
The 39-year-old stepped up to strike his spot-kick to the goalkeeper's left, and Oblak guessed right to push the ball onto the post to the relief of the Slovenian support.
Ronaldo was left in tears at the half-time break in extra-time as he reflected on his miss and wondered whether it would be a costly one.
Fortunately for him, he was given the chance to quickly make amends, scoring Portugal's first penalty in the shootout to help his country advance to the next round.
BEST STAT
MATCH STATS
Possession:Portgual 72%-28% Slovenia
Shots: Portugal 20-10 Slovenia
Shots on target: Portugal 6-2 Slovenia
Corners: Portugal 11-4 Slovenia
Fouls: Portugal 8-17 Slovenia
LINEUPS
PORTUGAL (4-3-3): Costa; Cancelo (Semedo 117'), Dias, Pepe (Neves 118'), Mendes; Fernandes, Palhinha, Vitinha (Jota 65'); B Silva, Leao (Conceicao 76'), Ronaldo
SLOVENIA (4-4-2): Oblak; Karnicnik, Drkusic, Bijol, Balkovec; Stojanovic (Verbic 86'), Gnezda Cerin, Elsnik (Ilicic 106'), Mlakar (Gorenc Stankovic 74'); Sporar (Celar 74'), Sesko