Updated

SAN FRANCISCO -- Jeff Samardzija pitched into the seventh inning to win his third consecutive start and the San Francisco Giants beat the Arizona Diamondbacks 6-3 on Sunday.

The Giants entered the day with the second-worst record in the NL, but jumped on Diamondbacks starter Patrick Corbin early and held on to win the series. Arizona still has a hold on the second NL wild-card spot despite dropping four of its last seven.

Hunter Pence hit a two-run single, Jarrett Parker homered and threw a runner out at the plate, and Nick Hundley drove in two runs for San Francisco.

Paul Goldschmidt had an RBI double and Daniel Descalso singled in a run for Arizona, which lost its second series to San Francisco this season.

Samardzija (7-11) allowed three runs on five hits before leaving after giving up a one-out single to Katel Marte then walking Chris Hermann in the seventh. Albert Suarez retired seven batters for his first career save.

Parker homered off Corbin (8-11) in the second, a two-out, two-run shot that put the Giants in front for good. Pence tacked on a bases-loaded single in the third after an error by Marte at shortstop extended the inning.

Parker also made a big defensive play in the third when he caught Marte's fly ball to left field then threw out J.D. Martinez at the plate.

Corbin allowed six runs, three of them earned, over six innings and matched his career-high of 10 strikeouts.

Diamondbacks infielder Brandon Drury was hit in the head by a pitch from Cory Gearrin while pinch-hitting in the seventh. Drury fell backward after getting hit but stayed in the game. Two days earlier, Giants first baseman Brandon Belt was hit in the head by a curveball from Anthony Banda.

UP NEXT

Following a day off Monday, RHP Zack Godley (5-4 ,2.86 ERA) faces the Los Angeles Dodgers in Arizona. Godley has not allowed a run over his past 13 innings.