SAN FRANCISCO — Ketel Marte homered for the third time in three games, Eduardo Escobar had three hits, and the Arizona Diamondbacks tied a franchise record for scoring in a three-game series as they beat the San Francisco Giants 6-2 Sunday to finish a sweep.

Mike Yastrzemski, the 23-year-old grandson of Hall of Famer Carl Yastrzemski, had the first three hits of his career for the Giants, who lost their fifth straight and finished a 1-6 homestand.

The Diamondbacks outscored the Giants 34-8 in the series, matching a franchise mark they set at home Sept. 12-14, 2016, against Colorado. It eclipsed the previous mark for a three-game road series — 32 against the Rockies on June 3-5, 2014.

Arizona’s outburst in this series came after they’d lost five straight and combined for seven runs in their previous four games.

Marte went deep in the first inning off Giants starter Shaun Anderson (0-1). His 12th homer started a two-run inning. Marte was 7 for 15 with three homers, a triple and six RBIs in the series and is 9 for 19 over his last four games.

Arizona swept the Giants in San Francisco for the first time since taking a four-game set April 18-21, 2016.

Diamondbacks starter Luke Weaver (4-3) pitched five-plus innings of six-hit ball for the win. He struck out six, walked two, and gave up one run before exiting with right forearm tightness after Buster Posey singled leading off the sixth.

Anderson, making his third major league start, gave up six runs — four earned — and nine hits, with a walk and two wild pitches in five innings.

Nick Ahmed sparked a three-run second inning in which the Diamondbacks had three hits and a walk and capitalized on a wild pitch and an error.

Diamondbacks closer Greg Holland notched his ninth save in 10 chances. He came into the game after pinch-hitter Stephen Vogt’s one-out double to left off Matt Andriese.

Posey and Joe Panik each had two hits including a double and one RBI for San Francisco.

ROSTER MOVES

The Giants recalled RHP Sam Coonrod from Triple-A Sacramento. The 22-year-old pitched a scoreless eighth in his major league debut. LHP Andrew Suarez was optioned to Sacramento, one day after giving up a career-high nine runs — seven earned.

TRAINER’S ROOM

Diamondbacks: 1B Christian Walker was hit by a pitch on his right thumb in the seventh but stayed in the game.

UP NEXT

Diamondbacks: RHP Zack Greinke (6-2, 2.89 ERA) will pitch Monday’s series opener in Colorado. The five-time All-Star is 4-1 with a 1.49 ERA with 39 strikeouts and five walks over his last seven starts.

Giants: RHP Jeff Samardzija (2-3, 3.27 ERA) will pitch Tuesday’s series opener in Miami. The 34-year-old is 5-2 with a 3.62 ERA in 18 games (nine starts) against the Marlins.