SAITAMA (Kyodo) -- Japan's bid for a first-ever Olympic soccer gold medal ended in heartbreak at the Tokyo Games on Tuesday as Spain snatched a 1-0 men's semifinal victory late in extra time through substitute Marco Asensio.
The Real Madrid forward curled the winner home from the right of the area in the 115th minute at a steamy Saitama Stadium, finally finding a way past Japanese keeper Kosei Tani, who had been outstanding for the Olympic hosts.
Spain will battle defending champions Brazil for gold, while Japan will now try to equal their best-ever Olympic result in men's soccer when they face Mexico in the bronze medal playoff.
Despite feeling "regretful" about the loss, Japan manager Hajime Moriyasu said his side must turn their attention to Friday's third-place match, when they will aim for a first medal since taking bronze at the 1968 Mexico City Games.
"Unfortunately, we were not able to win, but we will be ready for the next round. We talked about showing resilience in order to win a medal," Moriyasu said.
Luis de la Fuente's Spain side controlled the flow from early in the first half, dominating possession and using their short passing game to stretch the Japanese defense.
Japan, meanwhile, showed attacking intent in their limited time with the ball, going forward quickly on the counter.
Although they had more success pushing the action toward the Spanish end as the half progressed, the hosts were still unable to force a save from keeper Unai Simon by the interval.
Spain midfielder Mikel Oyarzabal blazed over the bar in the 31st minute, with the first of two clear chances for the men in white before halftime. Tani did well to prevent them scoring on the second, stopping Rafa Mir one on one after the Wolverhampton Wanderers forward was put through on goal.
Japan started the second half on the front foot and had an early chance when Daichi Hayashi shot over the bar after Reo Hatate found him up at the edge of the area.
But the opportunities dried up for Japan in the face of an increasingly assertive Spanish attack, with captain Maya Yoshida repeatedly called into action to head off danger at the back.
Japan endured an agonizing video review early in the second half after Yoshida was initially penalized for felling Spanish midfielder Mikel Merino, but the call was overturned, with replays showing Yoshida first to the ball.
Tani proved his mettle again in the 76th minute, producing a superb sliding save to deny Mir from close range.
With Japan surging forward on a counterattack, Takefusa Kubo sent a blistering shot from the left of the area, straight into the gloves of Simon.
Japan survived a white-knuckle sequence in the closing stages, with center-back Kou Itakura and Tani putting their bodies in the way of back-to-back shots following a Spanish corner.
Tani continued to stand tall as the final minutes ticked away, stopping Carlos Soler and then Oyarzabal from close range.
Despite Spain looking the more dangerous in extra time, Japan nearly snatched a winner when substitute Daizen Maeda headed over the bar off a cross from Yuta Nakayama.
Following a quick throw-in from the right, Oyarzabal sent a short ball in to Asensio, who turned and curled his shot past a diving Tani.
Winger Yuki Soma said the result showed the gap in quality remaining between Japan and the top-tier soccer nations.
"I think it really comes down to the quality of the moves we make. And that's the difference between teams being able to move onto the next stage or not," Soma said.
Brazil beat Mexico 4-1 on penalties after a scoreless draw following extra time in the other semifinal.