Spain laboured to a 1-0 extra-time win over hosts Japan to set up a final with Brazil and a shot at a second men's Olympic football gold medal - a feat they first achieved in 1992 at the Barcelona Olympics.
Although they dominated possession and had the bulk of the chances from early on, they struggled to translate that dominance into goals with Rafa Mir in particular snatching at chances.
The Wolverhampton Wanderers striker was drafted into the starting line-up for the first time this tournament thanks to a late hat-trick in the previous round against Ivory Coast.
Dani Alves becomes the most decorated player in football as Brazil secure Olympic gold
However, the man he replaced in the XI - Marco Asensio - turned super-sub in the closing minutes of extra-time when he curled a shot into the bottom-left corner after receiving Mikel Oyarzabal's short pass with his back to goal.
That ensured no repeat of the penalty shootout from earlier in the other semi-final between Mexico and Brazil.
Japan will now face the former on Friday in the bronze medal match, while Spain play the latter on Friday in the final.
TALKING POINT - What fatigue?
While it is nothing short of an incredible achievement for Pedri to make 70 competitive appearances in a season, especially at the age of 18, it is also difficult not to view the situation with concern given the risk of burnout.
He is also one of six players in the Spain squad who also featured at the Euros this summer.
That again prompts mixed feelings from football fans because although it is nice to see a country - particularly a European one - take the men's Olympic football tournament so seriously, it further raises concerns of players being overworked and forced into a congested fixture schedule during this pandemic.
All we can do is hope they are given more than enough holiday after this tournament is over and allowed to rejoin their club sides only once they feel sufficiently rested, even if that means missing a sizeable chunk of their team's opening games.
PLAYER OF THE MATCH - Marc Cucurella (Spain)
The Getafe left-back felt omnipresent during this game, constantly contributing in both attack and defence. His dynamism and movement ensured that he was always finding pockets of space on the left flank and it was unfortunate that his teammates today lacked the clinicality in front of goal to reward him with an assist or two for his performance.
Japan: Tani 7, Saki 7, Yoshida 8, Itakura 7, Nakayama 7, Endo 6, Tanaka 6, Doan 6, Kubo 6, Hatate 6, Hayashi 5...Subs: Soma 6, Ueda 5, Miyoshi 6, Maeda 5, Hashioka N/A
Spain: Simon 6, Cucurella 8, Torres 7, Garcia 7, Gil 7, Zubimendi 7, Pedri 6, Merino 7, Olmo 6, Mir 5, Oyarzabal 7...Subs: Vallejo 7, Soler 7, Asensio 8, Moncayola 6, Miranda 6, N/A
39' - SAVED! A swift move from Spain gets the ball from centre-back Torres to their central striker Mir in just two passes, but his first-time attempt is saved brilliantly by Tani!
55' - PENALTY TO SPAIN! Cucurella sends in a cross, the ball deflects into the path of Merino and he appears to be brought down unfairly by Yoshida. However, replays suggest that Merino was fairly tackled and that he caused himself to fall over by accidentally kicking Yoshida after being fairly tackled.
57' - IT'S BEEN OVERTURNED! After a couple minutes of checking VAR, Spain no longer have a penalty and Yoshida's had his yellow card rescinded too! Can that spur more attacking intent from the two teams though?
88' - TWO BIG SAVES FROM JAPAN! Back to back chances for Spain. Firstly Zubimendi shoots into the hands of Tani then moments later Mir has his shot saved from a narrow angle, oblivious to the fact Puado's wide open in the middle of the area!
116' - GOAL!! A simple pass finds Asensio in the box with his back to goal and in two touches he turns and shoots majestically curling a shot into the top left corner. Japan only have a few minutes to equalise!
Watch every unmissable moment live from Tokyo 2020 across Eurosport, Eurosport app and discovery+. Download the Eurosport app for iOS and Android now.
'Look at the pace he's got here' Malcom races away to secure football gold for Brazil
'Didn't fancy him at all!' - Richarlison with penalty shocker for Brazil in final