PHOENIX --Joe Panik homered for the second straight night, Jeff Samardzija had another strong outing and the San Francisco Giants made it two in a row in Arizona with a 3-1 victory over the Diamondbacks on Friday night.
Samardzija (5-2) pitched out of trouble early and went eight innings for the third time this season, giving up a run and scattering eight hits to improve to 4-1 in his last five starts.
Shelby Miller (1-4) blanked the Giants on four hits through five innings but faltered in the sixth, allowing two singles and Panik's three-run homer.
Miller's first career triple, and Jean Segura's RBI single, had given Arizona a 1-0 lead in the fifth.
Miller went 5 2/3 innings, giving up three runs on seven hits.
Left-hander Josh Osich retired left-handed hitting Jake Lamb for the first out in the ninth and Santiago Casilla came on to strike out the final two for his eighth save in 11 tries.
The visitor won for the 22nd time in the last 27 meetings between the teams. Arizona fell to 5-14 at home.
Miller led off the fifth with a shot over the head of center fielder Denard Span. The Diamondbacks pitcher made it to third, despite staggering and almost falling after rounding second. Segura's RBI single extended his hitting streak to 11 games. He has reached safely in 20 straight games.
Angel Pagan and Span singled to start the sixth, then Panik sent Miller's 3-0 pitch high down the right field line and into the seats for his fifth home run of the season. Panik's two home runs have accounted for five of San Francisco's seven runs in the first two games of the four-game series.
The Diamondbacks turned five double plays, in the second, third, fourth, eighth and ninth innings.
Arizona stranded four runners, three in scoring position, in the first two innings.