Tetsuto Yamada's tie-breaking three-run double in the eighth inning lifted Japan into the Tokyo Olympic baseball gold medal game with an intense 5-2 win over archrival South Korea in Wednesday's semifinal.

With two outs and the bases loaded, the Yakult Swallows slugger drilled a fat pitch from reliever Go Woo Suk to give Japan the lead for good at Yokohama baseball stadium.

Tetsuto Yamada of Japan hits a three-run double during the eighth inning of the Tokyo Olympic baseball semifinal against South Korea on Aug. 4, 2021, at Yokohama baseball stadium near Tokyo. (Kyodo) ==Kyodo

"I wanted to go after the first pitch. I was just a tiny bit late on it but I still got it on the sweet spot," said Yamada, who had a hand in all five Japan runs.

The South Koreans, however, still have a chance to defend their Olympic title from the 2008 Beijing Olympics. On Thursday, they play the United States with the winner advancing to the final and the loser to the bronze medal game against the Dominican Republic.

Japan is now guaranteed at least a silver medal, matching its best result since baseball became an official sport in 1992. The sport was dropped from the core Olympic program after 2008 but added to the Tokyo Games by the local organizers.

Hiromi Ito, one of two first-year pitchers on manager Atsunori Inaba's Samurai Japan, worked two scoreless innings to earn the win in relief, while the other rookie, closer Ryoji Kuribayashi, closed out the win in the ninth.

"I was able to execute my pitches the way I usually do," Ito said. "Of course, I was nervous but I managed to suck it up and do my best."

Japan starter Yoshinobu Yamamoto took a 2-0 lead into the sixth, but allowed the defending Olympic champions to tie it in the sixth. He struck out nine but allowed two runs on five hits and a walk.

Yamamoto escaped a first-inning jam, and was rewarded with a third-inning lead when his teammates scraped out a run against tricky side-armer Ko Young Pyo.

Ko, whose sinker was making hitters look bad, gave up back-to-back singles to Munetaka Murakami and Takuya Kai. Then a sacrifice bunt by Yamada moved the runners into scoring position and Murakami scored on a Hayato Sakamoto sacrifice fly to center.

Japan's Hayato Sakamoto hits a sacrifice fly to open the scoring in the third inning of the Tokyo Olympic baseball semifinal against South Korea on Aug. 4, 2021, at Yokohama baseball stadium near Tokyo. (Kyodo) ==Kyodo

Yamada slugged a leadoff double in the fifth, went to third on another fly by Sakamoto and scored on a Masataka Yoshida single.

South Korea, however, rallied in the sixth. Leadoff hitter Park Hae Min had a leadoff single to left field but reached second on a fielding error. Korea Baseball Organization batting leader Kang Baek Ho singled him home, before Yamamoto allowed another single and left with one out.

Korean captain Kim Hyun Soo, a veteran of the 2008 gold medal team, singled in the tying run off lefty reliever Suguru Iwazaki.

After two superb innings from Ito, Japan loaded the bases against Go with the help of a wild pitch, and two walks -- one intentional -- for Yamada, who missed a home run off the left field wall for a three-run Japan lead.

Earlier in the day, the U.S. beat the Dominican Republic 3-1, to book a spot in Thursday's semifinal.