Spain reached their first men's Olympic football final since Sydney in 2000 with a 1-0 win over host nation Japan after extra-time.
Real Madrid's Marco Asensio proved the difference in the 116th minute as he whipped past Koshei Tani to set up a final clash with defending champions Brazil on Saturday.
Mikel Merino nodded the first chance of the game wide before Rafa Mir, whose hat-trick powered his side into the semi-finals, should have opened the scoring but the forward poked into goalkeeper Tani's legs.
🤔 ¿Cómo celebrarías tú un golazo histórico en los últimos minutos de una prórroga?— Selección Española de Fútbol (@SeFutbol) August 3, 2021
☝️🏻👨🏻🦱☝️🏻Nosotros somos muy del "@marcoasensio10 style", para qué os vamos a engañar.
📸 (FOTOS: @UEFAcom_es)#JuegosOlímpicos #AlgoÚnico2020 #Tokyo2020 pic.twitter.com/Hbbbaq09bF
Merino thought he had atoned for his earlier miss by winning a second-half penalty but VAR intervened, deeming Maya Yoshida to have played the ball first.
Mikel Oyarzabal scuffed the final opportunity of normal time before Daizen Maeda headed agonizingly over Unai Simon's goal in the first-half of extra-time.
Heartbreak for Japan followed as substitute Asensio showed his quality by touching inside before calmly bending into the bottom left corner with just four minutes remaining.
The result could have been different, however, if Koji Miyoshi had not seen his shot blocked moments before Asensio's winner but Japan will now have to settle for a bronze-medal contest on Friday against Mexico.
Spain, who boasted six senior stars from Euro 2020, will now be hoping to go one further than silver at Sydney 2000 as they look to repeat the heroics of Barcelona 1992 that saw them claim gold.