Pablo Sandoval hit a two-run homer with one out in the top of the ninth inning and the San Francisco Giants rallied to beat the Arizona Diamondbacks 2-1 on Tuesday night.
Arizona starter Trevor Cahill left after allowing a leadoff single to Angel Pagan, the Giants' fourth hit against the right-hander. J.J. Putz (2-1) came on for Arizona and struck out Marco Scutaro, and quickly went ahead 0-1 on Sandoval.
But Sandoval drove Putz's next pitch, a hanging split-finger fastball, deep into the right-field stands to give Giants the lead and hand the struggling Diamondbacks closer his fourth blown save in nine chances.
Sandoval left Monday's game with discomfort in his right elbow after hitting an RBI single in the fifth inning, but was back in the starting lineup.
It was San Francisco's second straight come-from-behind victory, rallying for a 6-4 win in the series opener Monday.
Sandy Rosario (1-0) recorded the last out of the eighth inning for his first career win, and Sergio Romo pitched the ninth for his 10th save.
Josh Wilson had given the Diamondbacks a 1-0 lead with a home run in the bottom of the eighth off Santiago Casilla, who had come on after Madison Bumgarner threw seven scoreless innings. It was Wilson's first homer since June 25, 2011, for Milwaukee at Florida.
The late-inning power display was in sharp contrast to the game's first 7 1/2 innings. Bumgarner allowed three hits, walked one and struck out two before giving way for a pinch-hitter when his spot in the lineup came up in the eighth.
Cahill's line to that point was slightly better, with five strikeouts to go with the three hits and one walk through eight innings.
Only two players had reached base during the game for either side, both in the fourth. Scutaro singled to lead off the inning for the Giants and went to third on a single and fielder's choice, while Martin Prado singled to start the bottom of the inning and advanced on a two-out single.
The pitchers' duel was nothing new for Cahill, who has pitched in only one game decided by more than two runs so far. In his last four starts, both teams have combined for an average of 4.0 runs per game, including a 1-0 victory over Los Angeles on April 14 in which Cahill earned a no-decision after trading zeroes with Josh Beckett for 7 1/3 innings.
Over his past two starts, Cahill has allowed two runs — one earned — on eight hits over 13 innings.
Bumgarner struck out two, threw 62 of 102 pitches for strikes and lowered his ERA to 1.55. He became the first Giants pitcher with at least six starts of two or fewer runs since Kevin Correia went seven such outings in 2007.
NOTES: Arizona SS Didi Gregorius, who was hit in the head by a pitch from Colorado's Josh Outman on Friday and subsequently placed on the 7-day concussion list Sunday, passed all concussion exams Tuesday and was cleared to resume baseball activity. The rookie had appeared in seven games, going 11 for 27 with a pair of home runs. ... Giants manager Bruce Bochy said Scutaro will be given the day off Wednesday ahead of San Francisco's scheduled off day Thursday. ... Arizona signed OF Juan Rivera to a minor league contract. Rivera had been with the New York Yankees in spring training on a minor league deal after hitting .244 with nine homers and 47 RBIs for the Los Angeles Dodgers last season. ... The Diamondbacks traded minor league IF Mark Teahan to Cincinnati for a player to be named later. ... Giants LHP Jeremy Affeldt, eligible to come off the 15-day disabled list Wednesday, is scheduled to throw either during an extended spring game or for Class A San Jose and be reinstated Friday. ... Arizona RHP Brandon McCarthy will seek his first win with the Diamondbacks when he faces RHP Tim Lincecum and the Giants in the series finale Wednesday. Lincecum is 7-8 with a 3.44 ERA in 21 career starts against Arizona, but has lost his last six against the Diamondbacks dating to Sept. 29, 2010.