BALTIMORE — Manny Machado hit two home runs, Jonathan Schoop singled in the winning run with two outs in the ninth inning, and the Baltimore Orioles rallied past the New York Yankees 6-5 Tuesday night.

Greg Bird homered and drove in four runs for the Yankees, who own an inexplicable 4-5 record against the last-place Orioles.

Machado brought the Orioles back from deficits of 3-2 and 5-3 before Schoop won it in the ninth against Dellin Betances (1-3).

A hit batter, a double by Adam Jones and an intentional walk to Machado loaded the bases with one out. After Mark Trumbo struck out, Schoop hit a bouncer that glanced off the glove of Bird at first base and into right field.

Zach Britton (1-0) worked the ninth for Baltimore.

Bird hit a three-run homer and added a sacrifice fly to help New York go up by two runs in the seventh, but the lead wouldn’t last.

Machado had a solo shot in the fifth and a two-run homer in the seventh. Rumored to be traded before the July 31 non-waiver trade deadline, Machado has five multihomer games this season and 19 for his career.

RAYS 5, TIGERS 2: Wilson Ramos hit a three-run homer, five Tampa Bay pitchers combined on a five-hitter and the Rays beat visiting Detroit.

Tampa Bay lost its bid for a third shutout in four games when the Tigers scored twice in the ninth. After blanking the Mets in New York on Saturday and Sunday, the Rays outslugged the Tigers 10-9 in 10 innings Monday night.

Ramos, elected to start at catcher for the American League in next week’s All-Star Game, keyed a five-run third inning when he connected off Matthew Boyd (4-8) for his 14th homer. That tied John Flaherty (1999) for the most in a season by a Tampa Bay catcher.

NATIONAL LEAGUE

PHILLIES 7, METS 3: Enyel De Los Santos won his major league debut and Philadelphia got home runs from Maikel Franco and Odubel Herrera to win in New York.

Franco drove in four runs as the Phillies won for the 10th time in 13 games. Nick Williams had three hits and two RBI, and Rhys Hoskins also got three hits.

De Los Santos allowed three runs and five hits over 61/3 effective innings. The 22-year-old right-hander was called up from Triple-A Lehigh Valley, where he was 9-3 with a 1.89 ERA in 16 starts, and matched against another starter making his big league debut in Drew Gagnon of the Mets.

BREWERS 8, MARLINS 4: Christian Yelich had three hits and four RBI, Travis Shaw homered and Milwaukee won at Miami.

Shaw and Tyler Saladino had two RBI each, and Milwaukee won for the seventh time in nine games. Jhoulys Chacin (8-3) allowed four runs and seven hits in 52/3 innings. He struck out three and walked three.

Corbin Burnes pitched two perfect innings in his major league debut for the save.

Miami’s Pablo Lopez (1-1) pitched six innings and allowed five runs.

INTERLEAGUE

BLUE JAYS 6, BRAVES 2: Russell Martin’s sharp single in Toronto’s five-run eighth drove in the go-ahead run, Marcus Stroman pitched seven strong innings, and Toronto won at Atlanta.

The Braves have lost 6 of 7.

Toronto was limited to three hits through seven innings by Julio Teheran and Jesse Biddle, and the game was tied 1-1. The Blue Jays broke out with five hits off A.J. Minter (3-2) and Shane Carle in the eighth.

REDS 7, INDIANS 4: Joey Votto hit a go-ahead three-run double during a seven-run ninth inning as Cincinnati won at Cleveland.

Indians closer Cody Allen (2-4) allowed six runs after getting two outs in the ninth, the last three charged on Votto’s sharp hit to right off Dan Otero. Adam Duvall also doubled in two in the ninth, and Jose Peraza and Eugenio Suarez each hit an RBI single. Cincinnati had seven straight batters reach with two outs, and the inning didn’t end until Scooter Gennett ran into the third out at third base on Suarez’s single.