Japan's men's Olympic soccer team earned a tense 1-1 draw with gold medal candidates Spain on Saturday in their final warm-up before the start of the Tokyo Games.

Ritsu Doan scored Japan's opener three minutes before the break at Kobe's Noevir Stadium, where Spain dominated possession for all but the final minutes of the first half.

Ritsu Doan (2nd from R) of Japan scores the opening goal against Spain during the first half of a warm-up match for the Tokyo Olympics on July 17, 2021, at Noevir Stadium in Kobe, western Japan. (Kyodo) ==Kyodo

The Spaniards pressed relentlessly after the intermission and their persistence paid off in Carlos Soler's 78th-minute equalizer.

The hosts created more second-half chances, sparked by the introduction of speedy Yokohama F Marinos forward Daizen Maeda.

Japan came within a hair of winning it in the final move. Spain keeper Alvaro Fernandez, however, made a tremendous save after a free kick from the edge of the area by Japan midfielder Ao Tanaka rocketed off the leg of a defender.

"We came in with a focus on winning this game and it's unfortunate that we didn't," Japan manager Hajime Moriyasu said.

"However, the players showed the tenacity needed. It was big for us to get a goal against such strong opponents. We didn't get the winner, but we created the necessary opportunities."

Doan, who played last season in Germany on loan at Arminia Bielefeld, ran onto a cross from Real Madrid's Takefusa Kubo who had stolen the ball out on the left.

Martin Zubimendi of Spain (L) and Takefusa Kubo of Japan vie for the ball during the first half of a warm-up match for the Tokyo Olympics on July 17, 2021, at Noevir Stadium in Kobe, western Japan. (Kyodo) ==Kyodo

Doan's shot somehow found a path between two defenders and the keeper, before striking the bottom of the bar near the top left corner and going in.

The second half was a story of Spanish missed shots combined with tenacious Japanese defending, including some solid work from substitute keeper Keisuke Osako.

Spain's frustration ended roughly half an hour after the break, when defender Juan Miranda crossed to Soler, who had found space in the penalty area and side-footed through a crowd of defenders and in off the post.

The Olympic men's tournament gets under way on Thursday, when Japan open their Group A campaign against South Africa at Tokyo Stadium. Three days later, the hosts take on Mexico at Saitama Stadium, before finishing the group stage against France on July 28 at International Stadium Yokohama.