Japan's bid for a first-ever Olympic football 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.

Marco Asensio (R) scores in extra time in Spain's 1-0 men's football semifinal win over Japan at the Tokyo Olympics on Aug. 3, 2021, at Saitama Stadium near Tokyo. (Kyodo) ==Kyodo

Marco Asensio (2nd from R in white) scores in extra time in Spain's 1-0 men's football semifinal win over Japan at the Tokyo Olympics on Aug. 3, 2021, at Saitama Stadium near Tokyo. (Kyodo) ==Kyodo

Spain will battle defending champions Brazil for gold, while Japan will now try to equal their best-ever Olympic result in men's football 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.

Spain's Pedri (16) challenges Japan's Takefusa Kubo for the ball during the first half of a men's football semifinal at the Tokyo Olympics on Aug. 3, 2021, at Saitama Stadium near Tokyo. (Kyodo) ==Kyodo

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 football 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.

Brazil players celebrate after a penalty shootout win over Mexico in a men's football semifinal at the Tokyo Olympics on Aug. 3, 2021, at Kashima Stadium in Ibaraki Prefecture, eastern Japan. (Kyodo) ==Kyodo


Related coverage:

FEATURE: Olympic football fans let down by missed once-in-lifetime chances

Olympics: Japan beat New Zealand in shootout to reach men's football semis

Olympics: Maya Yoshida plays big brother to Japanese football's youngsters