WASHINGTON — Starling Marte hit a solo home run in the 18th inning and the Pittsburgh Pirates beat the Washington Nationals 2-1 Sunday in a marathon game that lasted almost six hours.

Pinch-hitter Daniel Murphy homered with two outs in the ninth inning for Washington, and it took a long while until anyone scored again.

Marte’s seventh home run of the season helped end the series finale as the Pirates avoided getting swept by the NL East leaders. The only longer game in the majors this season came July 1 when Cleveland beat Toronto in 19 innings.

METS 5, PHILLIES 0: Jacob deGrom tossed a one-hitter, Curtis Granderson and Asdrubal Cabrera homered and New York Mets won in Philadelphia.

DeGrom (6-4) allowed only a third-inning single to pitcher Zach Eflin and retired 27 of 29 batters. The lanky right-hander struck out seven, walked one and went the distance for the first time in 68 career starts.

MARLINS 6, CARDINALS 3: Ichiro Suzuki doubled, singled twice and had another hit taken away on a replay challenge, leaving him six hits shy of 3,000 as Miami won at St. Louis.

BRAVES 1, ROCKIES 0: Chase d’Arnaud singled with two outs in the ninth inning off Gonzalez Germen and Atlanta won at home to avoid a three-game sweep.

REDS 1, BREWERS 0: Billy Hamilton dashed home on All-Star Jonathan Lucroy’s passed ball with two outs in the ninth inning, giving host Cincinnati a win over Milwaukee.

DIAMONDBACKS 6, DODGERS 5: Robbie Ray pitched seven scoreless innings, Jake Lamb hit his 21st home run and host Arizona held on to beat Los Angeles to take two of three from the Dodgers.

PADRES 5, GIANTS 3: Edwin Jackson held San Francisco hitless until Conor Gillaspie’s three-run homer with one out in the seventh inning, and the Padres held off the Giants in San Diego.

American League

TIGERS 4, ROYALS 2: Jarrod Saltalamacchia hit a two-run homer in the bottom of the ninth inning to give Detroit a victory over Kansas City in Detroit.

RAYS 5, ORIOLES 2: Evan Longoria homered twice, Jake Odorizzi picked up his first home victory this season and Tampa Bay won for just the fourth time in 28 games by beating the AL East leaders.

INDIANS 6, TWINS 1: Josh Tomlin pitched 72/3 strong innings, Mike Napoli hit one of three Cleveland homers and the Indians beat host Minnesota.

ANGELS 8, WHITE SOX 1: Albert Pujols hit a pair of two-run homers, Jered Weaver pitched seven strong innings and Los Angeles completed an emphatic three-game sweep of Chicago in Anaheim, California.

BLUE JAYS 5, A’S 3: Josh Donaldson hit a tiebreaking two-run double with two outs in the ninth against his former team and Toronto won in Oakland, California.

ASTROS 8, MARINERS 1: Jose Altuve homered among his four hits and drove in three runs, Collin McHugh escaped a pair of bases-loaded jams to pitch six scoreless innings, and Houston won in Seattle.

INTERLEAGUE

RANGERS 4, CUBS 1: Cole Hamels pitched eight dominant innings in his first game at Wrigley Field since throwing a no-hitter at the famed ballpark a year ago, and Texas stopped a four-game slide.