DETROIT — Garrett Cooper hit a grand slam with two outs in the ninth inning and the Miami Marlins won their sixth in a row, rallying past Detroit 5-2 Thursday to finish a terrible homestand for the Tigers.

The Marlins, who had the worst record in the majors last week, extended the longest active winning streak in the big leagues.

The Tigers wrapped up an 0-9 stay at Comerica Park against Houston, Oakland and the Marlins. That record doesn’t include a suspended game in which Detroit trails Oakland in the late innings.

Miami benefited from a couple of fielding lapses by the Tigers in the ninth to come back against Shane Greene (0-2), who had been 15 for 15 on save chances this season.

It was 2-0 when Harold Ramirez opened the inning with a grounder that third baseman Dawel Lugo misplayed for an error. Ramirez later scored on Neil Walker’s single.

Greene later induced a double-play ball to second baseman Ronny Rodriguez that would’ve ended the game. But Rodriguez bobbled it and Miguel Rojas was called safe at first, which was held up on replay.

After an intentional walk to pinch-hitter Curtis Granderson loaded the bases, Cooper homered to deep left field. On Wednesday, Cooper hit his first career home run in a 6-3 win.

AMERICAN LEAGUE

YANKEES 6, ORIOLES 5: Mychal Givens walked Aaron Hicks with the bases loaded to force in the tie-breaking run in the ninth inning, and visiting New York completed a four-game sweep.

Clint Frazier and Luke Voit homered for the Yankees, who went deep 13 times during the series. New York has hit 35 home runs in going 10-2 against the Orioles, outscoring Baltimore 86-50.

Down 4-1 in the eighth, the Orioles mounted a surprising comeback. Two walks and an RBI single by Trey Mancini brought in Tommy Kahnle (2-0) from the bullpen, and Renato Nunez tied it with a three-run drive.

Yankees Manager Aaron Boone wrote out a starting lineup without Gleyber Torres and Gary Sanchez, who have combined to hit 19 home runs against the Orioles this season.

Boone cited the quick turnaround from Wednesday night’s game as the chief reason to rest his “studs,” but he called upon them in the ninth after Givens (0-2) struck out the first two batters.

Torres drew a walk and Sanchez singled before Givens walked DJ LeMahieu to load the bases. After going 3-0 on Hicks, Givens got two strikes before missing badly outside.

Zack Britton worked the ninth for his second save.

Baltimore has lost six straight. The Orioles own the worst record in the majors (15-35) and worst record at home (6-19).

RAYS 7, INDIANS 2: Ryan Yarbrough handled Cleveland’s lineup into eighth inning in his first start this season and Kevin Kiermaier legged out a three-run, inside-the-park homer when two outfielders collided as Tampa Bay won at Cleveland.

Tommy Pham, Avisail Garcia and Willy Adames hit solo homers off Adam Plutko (1-1) as the Rays improved baseball’s best road record to 16-7.

Yarbrough (3-1), recalled before the game after a stint at Triple-A Durham, allowed two runs and four hits in a career-high 7 1/3 innings. The left-hander began the year in Tampa’s bullpen, but struggled and was sent down April 24 to work on his mechanics.

He looked fine-tuned against the Indians, who dropped their fourth straight and nearly lost two more players to injury on a freakish play in the sixth.

With Tampa Bay leading 3-0, Kiermaier hit a sinking liner to left-center. Rookie left fielder Oscar Mercado and center fielder Leonys Martin converged on the ball before slamming into each other as they each made all-out attempts at catching it.

Mercado took the worst of the crash as Martin’s left knee drove hard into his right hip. As the two Indians players lay helplessly in the grass, the ball ricocheted toward the left-field corner and Kiermaier easily circled the bases for the first inside-the-parker allowed by Cleveland since 2008.

Martin was shaken while Mercado appeared seriously hurt. He was down for several minutes before getting to a crouch and finally standing. Mercado did some jogging as an Indians trainer and Manager Terry Francona looked on and he remained in the game only to be further tested in the inning as he had to race in to catch a short fly and line drive.

TWINS 16, ANGELS 7: Miguel Sano and Jonathan Schoop each hit two of Minnesota’s franchise record-tying eight home runs and the Twins hammered Matt Harvey and the Angels at Los Angeles.

C.J. Cron homered, doubled twice and singled twice for the Twins. Max Kepler, Jorge Polanco and Eddie Rosario also homered for Minnesota.

It was the third time in franchise history – dating to their days as the Washington Senators – and second time this season Minnesota homered eight times. Before doing it April 20 against Baltimore, the last time it happened was in 1963 against Washington.

Schoop drove in four runs and Sano three as the Twins won 6 of 7 on their trip that began in Seattle and wound up with their first sweep in Anaheim since 1996. Minnesota, with the best record in the majors, hit 22 homers against the Mariners and the Angels while outscoring them 67-24.

NATIONAL LEAGUE

PHILLIES 9, CUBS 7:  Jean Segura and J.T. Realmuto homered off Jon Lester, and Philadelphia won at Chicago for a split of the four-game series between division leaders.

Andrew McCutchen added two hits and two RBI as Philadelphia won for the fifth time in seven games. Aaron Nola (5-0) pitched 5 1/3 innings of three-run ball in his second straight victory.

Anthony Rizzo and Kyle Schwarber hit homers for Chicago, which had won 3 of 4. Rizzo finished with four hits and three RBI, but the NL Central-leading Cubs were unable to overcome a second consecutive shaky performance by Lester (3-3).

PIRATES 14, ROCKIES 6: Josh Bell, Bryan Reynolds and Starling Marte all homered in the seventh inning to lead Pittsburgh to a win at home.

The Pirates jumped on Rockies starter Antonio Senzatela (3-4) for eight runs over 3 1/3 innings, but Colorado stormed back in the sixth, scoring six runs that were charged to Pittsburgh starter Jordan Lyles (5-1).

Pittsburgh quickly fought back. Bell led off the seventh with a solo home run, his 16th of the season. He finished 3 for 4 with a double, a walk and two RBI.

Reynolds followed with a three-run home run to right-center field, his first career pinch-hit homer. Marte then hit a two-run shot to left, with all three homers coming against Colorado reliever Carlos Estevez.

METS 6, NATIONALS 4: Carlos Gomez lost his shoe during an early dash, then hit a go-ahead, three-run homer in the eighth inning that helped host New York overcome a Washington comeback that started after Washington Manager Dave Martinez’s heated ejection and a four-game sweep.

Gomez bolted around the bases, smacking himself in the helmet and letting out a few joyous shouts after his two-out shot against Wander Suero (1-4). It was the veteran’s first homer of the season and marked the third straight time New York beat Washington in its final turn at-bat.

The Nationals seemed as if they’d snapped from their funk after Martinez’s ejection in the eighth. Plate umpire Bruce Dreckman rang up Washington’s Howie Kendrick for a strikeout as he tried to check his swing leading off, then tossed the veteran infielder. Martinez charged from the dugout, spiked his hat and kicked dirt on home plate while barking relentlessly at Dreckman.

Juan Soto then walked against Robert Gsellman (1-0), Victor Robles singled, and Yan Gomes brought in Soto with a double. Gerardo Parra followed with a pinch-hit, two-run single for a 4-3 Washington lead.

Washington dropped to 19-31, a record better than only the Miami Marlins, Baltimore Orioles and Kansas City Royals. The Nationals have lost five straight and 6 of 7.

BRAVES 5, GIANTS 4: Austin Riley hit a tying home run in the eighth inning then drove in the go-ahead run in the 13th with a two-out single off Reyes Moronta, lifting Atlanta to a win at San Francisco.

Riley and Ozzie Albies both had three hits for Atlanta and Tyler Flowers homered. The Braves have won 10 of 13.

NOTES

YANKEES: Pitcher CC Sabathia was placed on the 10-day injured list with right knee inflammation.

Sabathia pitched five innings on Wednesday night and complained about knee soreness afterward.

He earned the victory despite allowing five runs and six hits. After the game, the 38-year-old Sabathia described it as “a shooting pain goes through every time that I land.”

He joins a list of prominent Yankees on the IL, including Aaron Judge, Giancarlo Stanton, Didi Gregorius, Dellin Betances and Troy Tulowitzki.

INDIANS: The hard cast is off Corey Kluber’s broken right arm, providing a dose of positive news for the struggling Indians.

Kluber, who may be months away from pitching in a game for Cleveland, said he felt relief in having the cast protecting his broken arm removed after a few weeks.

The right-hander broke his arm when he was struck flush by a line drive hit by Miami’s Brian Anderson on May 1. At the time, the Indians said surgery wasn’t needed, and it appears Kluber will be able to avoid an operation.

METS: The New York Mets said slugger Yoenis Cespedes is expected to miss the entire season after having ankle surgery.

The Mets said Cespedes, 33, had the operation on Thursday.

The team announced Monday that the oft-injured outfielder had broken his right ankle in an accident on his ranch.
• The Mets have added infielders Robinson Cano and Jeff McNeil to the 10-day injured list, putting half of New York’s opening day lineup on the shelf.

Cano strained his left quad running out a grounder in the third inning of a 6-1 win Wednesday night. He had an MRI during the game, which showed a low-grade strain.

McNeil has a tight left hamstring, which he thinks occurred while trying to steal second base in the ninth inning of a 6-5 win Tuesday.