PHOENIX -- Pablo Sandoval hit a two-run home run with one out in the ninth inning and Sergio Romo recorded his 10th save in San Francisco's 2-1 victory over Arizona on Tuesday.
Sandoval hit an 0-1 pitch from J.J. Putz (2-1) after Angel Pagan singled to right field to open the ninth and knock D-backs starter Trevor Cahill out of the game. Pagan stole second before Sandoval's homer, his fourth.
Putz suffered his fourth blown save of the season, the last two a week apart on ninth-inning homers by the Giants (15-12). It was the D-backs' major league-high 10th blown save.
Josh Wilson hit his first home run of the season in the top of the eighth off Santiago Casilla after Giants starter Madison Bumgarner shut out the D-backs (15-12) for seven innings.
Bumgarner gave up three hits and a walk while striking out two in seven innings. He was 3-0 with a 1.55 ERA in April, second in the National League behind St. Louis' Jake Westbrook (0.98) and just ahead of the New York Mets' Matt Harvey (1.56) in ERA for the month.
Romo is tied for the NL lead in saves in his first full season as closer.
Cahill gave up four hits and one walk and struck out five to lower his ERA to 2.43.
Cahill gave up a leadoff single to Pagan before retiring the next nine, using only 27 pitches through three innings.
Marco Scutaro and Sandoval singled to open the fourth, and shortstop Cliff Pennington saved a run when he made a diving stop of Hunter Pence's one-hopper in the hole, turning it into a force at second.
Bumgarner retired the first seven before giving up his first hit. The D-backs got singles from Martin Prado and Miguel Montero but did not score.
NOTES: Arizona shortstop Didi Gregorius (concussion symptoms) passed all the medical tests necessary for his return to the field and did pregame work Tuesday. Gregorius, hit in the right temple by a pitch Friday, is on the 7-day disabled list and is eligible to return Saturday, although no return date has been set. ... Giants left-hander Jeremy Affeldt (right oblique) is to pitch in an extended spring training game in Arizona on Wednesday and if there are no setbacks, he will join the Giants on Friday, manager Bruce Bochy said. He is eligible to return Thursday. ... San Francisco's Tim Lincecum will make his first start against the D-backs this season on Wednesday, and it is likely Arizona first baseman Paul Goldschmidt will be in the lineup. Goldschmidt is 8-for-14 with five home runs and 10 RBIs against Lincecum in his career. ... Tuesday marked the 52nd anniversary of Willie Mays' four-home run game in the Giants' 14-4 victory at Milwaukee in 1961. The Giants had a major league-record eight in that game, with two more by Jose Pagan and one apiece from Felipe Alou and Orlando Cepeda.