TAMPA, Fla. (AP) Ji-Man Choi raised his arms into the air as he saw his game-winning hit clear the infield.

There was good reason to celebrate after the Tampa Bay Rays kept themselves in the AL's second wild-card spot and avoided a series loss to the woeful Detroit Tigers.

Choi's two-run single in the bottom of the ninth completed a rally from a late three-run deficit and gave the Rays a 5-4 victory on Sunday.

''Pretty exciting moment,'' Tampa Bay manager Kevin Cash said. ''His teammates might have been halfway out there before the second run even came across.''

The Rays trailed 4-1 after seven before coming back with two in the eighth and then the winning hit in the ninth.

Travis d'Arnaud reached to open the ninth against Joe Jimenez (3-7) on shortstop Gordon Beckham's throwing error and went to second when Willy Adames walked.

The Rays loaded the bases on Mike Brosseau's one-out infield single before Choi singled to center.

''We kept on going and never gave up,'' Choi said through a translator. ''We were able to bring back the win.''

Tampa Bay had been hitless in 17 at-bats with the bases loaded since July 26.

Tommy Pham hit a two-run homer in the eighth off Buck Farmer that pulled the Rays within 4-3.

''Good teams find a way to win, and that's exactly what we did,'' Pham said.

Tampa Bay pitchers set a three-game series team record by recording 49 strikeouts, including 12 on Sunday.

Houston holds the major league record of 52, coming against Baltimore May 24-26, 2016.

The Rays lost 2-0 Friday night before winning 1-0 in 13 innings on Brosseau's single Saturday.

''We competed with a team that's in a playoff race,'' Tigers manager Ron Gardenhire said. ''It was in our hands, in our grip, we just lost it.''

Matthew Boyd struck out nine over seven strong innings and Harold Castro homered and had three RBIs for the Tigers, who have a major league-worst 37-84 record.

Boyd allowed one run, two hits and two walks. The lefty has 201 strikeouts in 153 innings.

''It was a big performance by him,'' Gardenhire said.

Boyd departed the ballpark before the game ended for the birth of his child.

Castro hit a two-run shot in the first and had a sacrifice fly during a two-run seventh.

Victor Reyes got the Tigers' first walk of the series leading off the first against Trevor Richards and scored on Castro's homer.

Detroit finished with three walks, with two coming in the ninth off Jose Alvarado (1-5).

After Reyes had an RBI double, Castro's sac fly in the seventh put the Tigers ahead 4-1.

Richards allowed two runs, eight hits and struck out six over 3 1/3 innings in his Tampa Bay debut. The right-hander, acquired from Miami on July 31, went 3-12 for the Marlins in 23 games, including 20 starts.

RARE COMPANY

Boyd joined Mickey Lolich (seven times) and Hal Newhouser (twice) as the only Tigers left-handers with 200 or more strikeouts in a season.

GETTING A BREAK

Tigers slugger Miguel Cabrera, hitless in nine at-bats with seven strikeouts in the first two games of the series, got the day off.

MOVING AROUND THE DIAMOND

d'Arnaud made his 15th start at first base and also took grounders at third base before the game. He has started 39 times behind the plate.

TRAINER'S ROOM

Tigers: OF Christin Stewart (concussion), C Grayson Greiner (lower back strain) and 1B Jeimer Candelario (sprained left thumb) were all in the Triple-A Toledo lineup for the second consecutive day.

Rays: RHP Tyler Glasnow, who went 6-1 before being sidelined by a right forearm strain in mid-May, will have his first bullpen session Monday. ... OF Avisail Garcia (right oblique strain) could be back in the next seven to 10 days.

UP NEXT

Tigers: RHP Edwin Jackson (3-5), a 17-year veteran, looks to win his third consecutive start since joining Detroit on Monday night at Houston. The AL West-leading Astros will counter with LHP Wade Miley (11-4).

Rays: LHP Brendan McKay (2-2) will go against Seattle LHP Marco Gonzalez (12-10) on Monday night.

---

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports

---

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports

Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.