J.T. Realmuto hit an RBI single that capped a three-run rally in the eighth inning off NL ERA leader Sandy Alcantara, and the Philadelphia Phillies beat the visiting Miami Marlins 4-3 Wednesday night for their seventh straight win.

Kyle Schwarber had three hits and drove in two runs as the Phillies won for the 12th time in 13 games. They are 41-19 since June 1, vaulting them into second place in the wild-card race.

JJ Bleday singled, doubled, tripled and drove in a run for Miami, which has lost nine of 11.

Alcantara (10-5), a leading candidate for the NL Cy Young Award, began the day with a 1.88 ERA. He had allowed only two hits and held a 3-1 lead before the Phillies tagged him for six hits in the eighth.

MARINERS 4, YANKEES 3 >> Carlos Santana snapped an 0-for-17 slump with a go-ahead two-run homer during a three-run seventh, and host Seattle rallied to beat skidding New York.

Aaron Judge hit his major league-leading 45th homer for the Yankees, who have lost eight of 10.

Thanks to two one-run victories, Seattle took two of three from New York for the second straight week to win the season series 4-2. The Mariners won 1-0 in 13 innings on Tuesday night.

Kyle Higashioka hit a go-ahead, two-run homer on the 115th and final pitch from Seattle starter Robbie Ray in the seventh to snap a 19-inning scoreless streak for the Yankees, and Judge’s longball against Penn Murfee (3-0) made it 3-1 later in the frame.

Yankees starter Nestor Cortes struck out 10 and didn’t allow a hit until Sam Haggerty homered off the left-field foul pole with one out in the sixth. He was lifted after giving up consecutive singles to Ty France and Mitch Haniger to open the seventh. Haniger’s hit scored France to make it 3-2.

Albert Abreu (2-2) struck out Eugenio Suarez but left a changeup in the middle of the plate and Santana didn’t miss, hitting his seventh home run since being acquired by Seattle in June.

Ray allowed three hits and two runs in 6 1/3 innings. He struck out seven but walked five.

PADRES 13, GIANTS 7 >> Brandon Drury hit a go-ahead, three-run home run in the sixth and Austin Nola’s two-run homer capped a seven-run rally — all with two outs — that carried San Diego to a wild home victory over San Francisco.

The Padres fell behind 4-0, surged ahead 6-4 after Manny Machado’s two-run double ignited a six-run rally in the third and then fell behind 7-6 in the sixth. But the Padres came through with another big rally in the bottom of the sixth.

Drury lined a 1-2 pitch from Yunior Marte (0-1) into the seats in left field with two outs to make it 9-7. Machado and Josh Bell were aboard on singles. The Padres added on with Kim Ha-seong’s RBI double, an error and then Nola’s shot into a balcony on the Western Metal Supply Co. Building in the left field corner.

Drury finished with four RBIs.

METS 10, REDS 2 >> Francisco Lindor scored three times, tying David Wright’s franchise record by scoring a run in 13 consecutive games, and New York defeated visiting Cincinnati for its sixth straight win.

Lindor finished 2-for-3 with a walk and two RBIs.

Taijuan Walker (10-3) pitched six solid innings to reach double-digit wins for the first time since he went 11-8 for Seattle in 2015. Trade-deadline addition Daniel Vogelbach drove in three runs and Tyler Naquin homered for the NL East-leading Mets.

BRAVES 8, RED SOX 4 >> Top Atlanta prospect Vaughn Grissom homered onto Lansdowne Street in his major league debut, and Marcell Ozuna hit a three-run homer to lead Atlanta over Boston at Fenway Park.

Called up earlier in the day from Double-A, the 21-year-old Grissom hit the first pitch he saw in the seventh inning over the Green Monster and the seats above it and onto the street below for his first big-league hit. He tossed his bat aside before taking off around the bases, clapped his hands as he rounded third base and arrived home to be congratulated by Michael Harris II, who had singled ahead of him.

Grissom singled in the ninth, stole second and scored as Atlanta completed a two-game sweep.

The last-place Red Sox lost their fourth straight and their sixth of seven.

Kyle Wright (14-5) allowed one run on one hit and one walk in six innings, striking out five, to earn the win.

Red Sox trade deadline pickup Tommy Pham homered for the third straight game, hitting a three-run shot in the seventh to trim the deficit to 5-4.

RANGERS 8, ASTROS 4, 10 innings >> Leody Taveras drove in a career-high five runs, including a bases-clearing double as part of a five-run 10th as visiting Texas topped Houston.

Marcus Semien hit a bases-loaded sacrifice fly off Phil Maton (0-2) to put Texas ahead 4-3 in the 10th and Corey Seager followed with an RBI single.

The Rangers loaded the bases again and Taveras cleared them with a drive into the right-center gap.

Taveras also had a sacrifice fly in the sixth and an RBI triple in the fourth off Justin Verlander, who yielded three runs on five hits with seven strikeouts in six innings.

CARDINALS 9, ROCKIES 5 >> Albert Pujols and Nolan Arenado homered and combined for seven hits as St. Louis scored a road victory over Colorado.

Pujols and Arenado had run-scoring hits in the Cardinals’ five-run first inning and connected on back-to-back homers in the sixth for an 8-2 lead.

Pujols, whose home run was No. 687 of his career, had four hits and finished a triple short of the cycle.

Jose Quintana (4-5) gave up two runs and seven hits and struck out six in his second quality start since being obtained from Pittsburgh on Aug. 1.

Paul DeJong tied a career high with four hits and had an RBI, Lars Nootbaar had two triples and two RBIs.

BREWERS 4, RAYS 3, 10 INNINGS >> Rowdy Tellez hit a tying homer in the ninth inning and Willy Adames had a game-ending RBI single in the 10th as Milwaukee topped Tampa Bay.

Adames came up in the 10th following an intentional walk to Christian Yelich. His grounder off Ryan Thompson (3-3) got past diving shortstop Taylor Walls and scored automatic runner Tyrone Taylor.