ST. PETERSBURG, Fla. — Jose Altuve homered, the Houston bullpen pitched 4 1/3 scoreless innings and the Astros beat the Texas Rangers 5-1 on Thursday in the last game before they return to their flood-ravaged home city.

Josh Reddick added an RBI single for the AL West-leading Astros, who avoided a three-game sweep at the hands of their instate rivals at Tropicana Field, where the series was relocated because of Hurricane Harvey.

Houston will have a previously unscheduled day off Friday and play a doubleheader Saturday against the Mets at Minute Maid Park. The downtown Houston stadium escaped major flood damage. Astros president Reid Ryan has said he hopes the weekend games “can serve as a welcome distraction” for the city.

For the Rangers, it was their first loss all year at the Tampa Bay Rays’ home park. They swept the Rays in a three-game series in June.

Chris Devenski (7-3) worked 2 1/3 innings in relief of Collin McHugh to get the win. Ken Giles pitched the final two innings for his 27th save in 30 opportunities.

Altuve’s home run, his 21st, came off Nick Martinez (3-6) in the first.

DIAMONDBACKS 8, DODGERS 1

PHOENIX — Zack Greinke earned his major league-best 16th victory with six strong innings, and the Arizona Diamondbacks beat Los Angeles to complete the first series sweep of the Dodgers this season.

Chris Iannetta and A.J. Pollock homered for the Diamondbacks, who matched their season-best seventh straight victory and pulled 3 1/2 games ahead of idle Colorado for the National League’s top wild-card spot.

The Dodgers, still with by far the best record in the majors (91-40), have lost a season-worst five in a row.

Greinke (16-6) allowed a run and four hits, striking out six and walking two, to improve to 13-1 in 16 home starts this season.

Kenta Maeda (12-6) went just three innings and gave up seven runs and eight hits.

TWINS 5, WHITE SOX 4

MINNEAPOLIS — Max Kepler was hit by a pitch with the bases loaded and two outs in the bottom of the ninth inning, and Minnesota rallied to beat Chicago.

Trailing 4-3 entering their final at-bat at Target Field, the Twins came back to win their fourth straight and maintain their slim lead for the second AL wild-card spot. The Twins completed a three-game sweep with their first hop-off win since current Minnesota manager Paul Molitor was plunked in the 10th at the Metrodome in 1996 to beat Kansas City.

Pinch-hitter Ehire Adrianza opened the ninth with an infield single off closer Juan Minaya (2-2). After a one-out walk, Eddie Rosario hit a tying single.

Joe Mauer then walked to load the bases and Jorge Polanco lined back to Minaya. With the crowd on its feet, Minaya’s first pitch hit Kepler in the front lower leg for the winning run. Knocked to the ground, Kepler got up quickly and trotted to first.

Alen Hanson hit a solo home run in the top of the ninth to give the White Sox a 4-3 lead. He connected off Matt Belisle (1-2).

REDS 7, METS 2

CINCINNATI — Joey Votto hit a home run, then gave a bat and jersey to a 6-year-old cancer patient as Cincinnati beat New York.

Votto homered in the seventh. He high-fived the young fan he knows through the Make-A-Wish Foundation.

Scooter Gennett drove in three runs with a homer and a double off Jacob deGrom (14-8).

The Reds took two of three for a rare series win against the Mets. Heading in, New York had won 14 straight games against Cincinnati, including eight in a row at Great American Ball Park.

The Mets head for Houston, where they’ll have a day off on Friday before playing a doubleheader on Saturday. Players planned to help with flood recovery and cleanup efforts for those affected by Hurricane Harvey.

Robert Stephenson (3-4) won his third straight start, allowing two runs and five hits in six innings.