San Francisco's Pablo Sandoval, right, salutes teammate Angel Pagan after Sandoval hit a two-run homer in the ninth inning that gave the Giants their victory.


PHOENIX - A sore elbow couldn't slow Pablo Sandoval.

The San Francisco third baseman hit a two-run homer with one out in the top of the ninth inning and the Giants rallied to beat the Arizona Diamondbacks 2-1 on Tuesday night.

Sandoval was taken out of the Giants' win Monday by manager Bruce Bochy after hitting a tying RBI single in the fifth inning because of discomfort in his right elbow.

After Tuesday's game, his right arm was wrapped in ice from his forearm to shoulder, but the pain couldn't erase his wide smile.

"I don't want to come out of the game," Sandoval said. "But he made a good point and said, 'I'd rather lose you for two at-bats than for three weeks.'

"Today, I came out and felt good, less pain. I told Bochy I want to play. I don't want to come out. I just want to play."

Sandoval also singled in the fourth against Arizona starter Trevor Cahill and is 11 for 17 in his past four games.

"He's swinging good," Bochy said. "When you get a good hitter like that in the zone, it's fun to watch. We weren't sure he was going to play, but he shows up, says he fine, and ends up swinging the bat well."

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 the Giants the lead and hand the struggling Diamondbacks closer his fourth blown save in nine chances.

"It seems like every time I leave one of those up it's getting crushed right now," Putz said. "It's frustrating. I made some pretty good pitches on Scutaro, some good pitches on (Buster) Posey (following Sandoval). The one to Sandoval just didn't come out of my hand right."

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.

"I figured he would leave me in until I got somebody on," Cahill said. "It's real frustrating when it is so close and you can't finish it out. You're going to kick yourself even more than if you only went three and gave up 10 runs. It's a bad feeling."

The pitchers' duel was nothing new for Cahill, who has pitched in only one game decided by more than two runs so far. Over his past two starts, Cahill has allowed two runs - one earned - on eight hits over 13 innings.

"I didn't want him to take the loss," said Arizona manager Kirk Gibson. "I had confidence in my closer and it didn't work out."


• What: Giants at Diamondbacks

• When: 6:40 p.m.

• TV; radio: FSAZ; 1490-AM, 104.9-FM