Japanese two-way star Shohei Ohtani hit a tie-breaking solo shot and matched a career high with his 22nd homer of the season in the Los Angeles Angels' 3-2 victory over the Texas Rangers on Wednesday.

Ohtani, who is scheduled to undergo right elbow reconstruction next week, connected off former Nippon Ham Fighters teammate Chris Martin (1-5) in the eighth to break a 2-2 tie and send the Angels to a three-game sweep of the Rangers at Anaheim Stadium.

The 24-year-old rookie also had an RBI single in the fourth that erased a 1-0 deficit.

"A lot of my at-bats have been good. I've been learning a lot," Ohtani said.

"(Martin) takes command (on the mound). I saw him pitch in a game (in the majors) for the first time. It won't happen this year but if I have another chance to face him next year I'll do my very best," he said.

(Ohtani's 22nd home run)

Ohtani had 22 homers for Nippon Ham in 2016, when Martin also played in Japan. Ohtani, a right-handed pitcher and left-handed slugger, signed a minor league contract with the Angels last offseason.

The team announced a day earlier Ohtani will have Tommy John surgery after the regular season ends, which means he will miss the entire 2019 season as a pitcher but could still return as a hitter.

In Wednesday's game, Jose Alvarez (6-4) worked a perfect eighth for the win in his 76th appearance.

At St. Petersburg, Florida, Masahiro Tanaka was removed from the game after four-plus innings for the second time in as many starts as the New York Yankees' four-run rally in the ninth inning was not enough in an 8-7 loss to the Tampa Bay Rays.

In his final start before the playoffs, Tanaka (12-6) gave up four runs -- three earned -- and six hits while striking out four and walking one in an 80-pitch effort at Tropicana Field.

"My splitters were not effective and I got myself in trouble," said Tanaka, who was tagged with his sixth loss of the season.

"These last two starts have been disappointing for me personally. I have to make adjustments every day and maximize my performance," he said.

(Tanaka is pulled during the fifth inning)

The 29-year-old Japanese squandered a three-run lead in the bottom of the first when he allowed the Rays to get on the board with a Joey Wendle single and score another run on a throwing error. Wendle scored the game-tying run on an RBI single by Willy Adames.

In the third, Tanaka surrendered a go-ahead solo shot to Tommy Pham, and in the eighth, the Rays added four more runs for insurance.

Tanaka took the mound in the fifth but left without getting a single out.

In the top of the ninth, designated hitter Aaron Judge sparked a four-run burst with an RBI single off Sergio Romo, but the Yankees came up short against the 35-year-old closer who got the final four outs for his 24th save.

Yonny Chirinos (5-5), who relieved Tampa Bay starter Ryne Stanek and threw four scoreless innings from the second, earned the win.