DETROIT (AP) The Texas Rangers were great until the rain showed up. After that, they were holding on.

The Rangers led 5-0 when heavy showers forced a 29-minute rain delay in the top of the fourth inning Thursday night. The first batter after the delay hit a two-run homer to give the Rangers a 7-0 lead, but it was all Detroit Tigers after that.

The Tigers had the winning run at the plate with no one out in the ninth inning, but closer Keone Kela retired the next three batters to finish off a 7-5 victory and snap a three-game losing streak.

The Rangers didn't arrive in Detroit until the early hours of Thursday morning after an extra-inning loss to the Astros the previous night.

''We had a tough night last night and some tough travel, but our guys showed up tonight,'' Rangers manager Jeff Banister said. ''We needed to get a win to gain some momentum and gain some confidence.''

Yovani Gallardo (3-0) got the win, giving up four runs and eight hits in 5 1/3 innings. He walked one and struck out two while winning his third straight start.

Kela allowed a run in the ninth - the first he's given up in 12 career innings against Detroit - before finishing off his 21st save.

Matthew Boyd allowed a season-high seven runs and seven hits in four innings. He is 0-3 with a 10.59 ERA in his last four starts.

''Everyone goes through good stretches and bad stretches at this level, and a lot of it depends on luck,'' he said. ''Once the game is over, you have to put it away and focus on getting ready to take the ball in five days.''

Tigers bench coach Steve Liddle, who managed while Ron Gardenhire recovered from the heat exhaustion that caused him to leave Wednesday's loss in Chicago, wasn't pleased with Boyd's pitch selection.

''He never threw his fastball, so they were sitting on his soft stuff all night,'' Liddle said. ''They saw what he was doing and made adjustments, but he never made any adjustments to counter that.

''You can't throw the same thing over and over and expect to win games.''

Detroit lost is third straight and dropped to 2-14 since June 17.

''We were down a touchdown early and we had the winning run at the plate in the ninth,'' Liddle said. ''That's something positive we can take from this.''

The Rangers took a 2-0 lead in the second inning when Gallo became one of the few players to clear Comerica Park's right-field stands with a home run. Gallo came into the game hitting .191 with 20 homers.

Nomar Mazara made it 3-0 with an RBI grounder in the third, and Tigers third baseman Ronny Rodriguez misplayed Adrian Beltre's grounder to allow a fourth run to score.

Isiah Kiner-Falefa's fourth-inning RBI single extended the Rangers' lead to 5-0 on the final pitch before a 29-minute rain delay. The game had started 15 minutes late due to a brief rain shower.

On Boyd's fifth pitch after play resumed, Guzman hit a two-run homer to put Texas ahead by seven.

The Tigers made it 7-3 in the bottom of the fourth on RBI singles by John Hicks, Jim Adduci and Rodriguez, but Gallardo got Jose Iglesias to hit into an inning-ending double play.

''It's tough coming out of the rain delay,'' Gallardo said. ''We were ready to start the game and it rained, and then I had to stay loose through the second one. I gave up those three runs, but we got out of it.''

Goodrum homered in the sixth to make it 7-4.

Rodriguez started the ninth with an infield single and Iglesias reached on an error by third baseman Jurickson Profar. Victor Reyes followed with an RBI single to make it 7-5, but pinch-hitter Jeimer Candelario bounced into a force at second.

Kela struck out Nicholas Castellanos and retired Goodrum to end the game.

TRAINER'S ROOM

Rangers: RHP Chris Martin (groin) was placed on the 10-day disabled list and RHP Ricardo Rodriguez was recalled from Triple-A Round Rock. ... LHP Martin Perez (elbow) was scheduled to make his third rehab start for Round Rock on Thursday. Perez has not pitched for the Rangers this season after elbow surgery.

Tigers: Gardenhire was told by doctors to stay in the air-conditioned clubhouse with the heat index approaching 100 degrees at game time. Temperatures are forecast to be much cooler in Detroit on Friday. ... RHP Drew VerHagen (broken nose) is expected to make one more rehab appearance for Triple-A Toledo before rejoining the Tigers.

BANISTER'S MILESTONE

The win was Banister's 300th as a manager in his 574th game, making him the fastest manager to 300 wins in Rangers history. ''It's a nice milestone for the organization and the ball club,'' he said. ''I've been fortunate enough to be granted a great opportunity here.''

UP NEXT

Bartolo Colon (5-5, 4.76) will try to break a tie with Dennis Martinez for most wins by a pitcher born in Latin America when he starts against the Tigers on Friday. Colon is the last active major-league player to have played at Tiger Stadium, which closed in 1999. Jordan Zimmermann (3-0, 3.91) is scheduled to start for Detroit.

---

More AP baseball: https://apnews.com/tag/MLBbaseball

Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.