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 encounter, 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.
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, before his cross breaks to Silva, who fails to hit the target with a wild left-footed 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-footed 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 fires straight at Oblak after latching onto Diogo Jota's well-weighted through-ball.
FULL TIME: PORTUGAL 0-0 SLOVENIA
100th min: First real sight of goal in extra time. Jota rises to meet Francisco Conceicao's lofted cross, but he can only direct a tame header at Oblak.
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 Palhinha'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 prevent Slovenia from netting 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 is a moment 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 the right way to push the ball onto the post to keep his country in the contest.
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 STATS
MATCH STATS
Possession: Portugal 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