SAN FRANCISCO (AP) - 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.