Matt Cain has picked up right where he left off in a superb postseason.

The right-hander had his third strong outing in three appearances this season and Pablo Sandoval hit a three-run homer to lift the San Francisco Giants to their third straight victory, 5-2 over the Arizona Diamondbacks on Friday night.

Cain (2-0) allowed one run on four hits in six innings — plus two batters. The right-hander threw six scoreless innings, then gave up a popup double down the right field line to Stephen Drew and hit Melvin Mora to end his night in the seventh. Drew later scored, just the third run charged to Cain in 19-plus innings this season.

"He's really, I think, grown so much over the past year and a half," manager Bruce Bochy said of a pitcher that he believes now ranks among the best in the National League. "He's carried what he did in the postseason to this year, that's mixing up pitches, quality strikes. He's got a good changeup going and good poise out there."

Cain threw 21 1-3 innings without allowing an earned run in the Giants' postseason run to the World Series title.

"I definitely go back to the postseason where I mentally was and try to use that to my advantage," he said.

Arizona manager Kirk Gibson said Cain "throws at least three pitches and throws them at any count."

"He is very unpredictable," Gibson said. "He knows he can pitch and he knows he is good. He comes right at you with good stuff. We aren't the only guys he has beat up on."

Sandoval's third homer of the year, on a changeup in the middle of the plate off Daniel Hudson in the first inning, provided all the offense the Giants needed. Sandoval also walked and scored in the first of Miguel Tejada's two doubles.

"I just tried to get a good pitch to hit," Sandoval said, "get relaxed at the plate and get a good pitch you can hit."

Bochy said Sandoval has secured the No. 5 spot in the batting order against right-handed pitchers.

Hudson (0-3) matched his career high with 10 strikeouts but allowed five runs, four earned, on six hits and three walks in six innings. He has received one run of support in his three starts this season.

Brian Wilson came on with runners at first and second and two outs in the ninth. He gave up an RBI single to Willie Bloomquist before getting slumping Kelly Johnson to pop out for his third save in four tries.

With one out in the first, Freddy Sanchez singled off the glove of third baseman Melvin Mora, then Buster Posey singled up the middle to bring up Sandoval. With two outs, on a 1-0 pitch, the still big — but not as big as before after an offseason conditioning program — hit a towering shot over the swimming pool in right field to put the Giants up 3-0.

San Francisco added one in the fourth when Sandoval drew a leadoff walk, Brandon Belt singled and Tejada doubled down the left field line. Cain followed with a low liner to right fielder Justin Upton, who made the catch and threw home as Belt was held at third. Upton had two singles off Cain.

The Giants scored an unearned run in the fifth. After Aubrey Huff walked and Posey singled, San Francisco went with a double-steal. Catcher Miguel Montero threw wild to third allowing a runner to score and make it 5-0.

After Cain departed in the seventh, left-hander Jeremy Affeldt fanned Montero but walked pinch-hitter Xavier Nagy to load the bases. Bloomquist's RBI sacrifice fly off reliever Ramon Ramirez ended the shutout.

NOTES: Giants RHP Tim Lincecum is donating $25,000 to the Bryan Stow Fund to benefit the San Francisco fan critically injured in an attack following the season opener at Dodger Stadium on March 31. ... Bloomquist stole his seventh base of the season. ... Hudson got his third hit in five at-bats. ... Johnson robbed Sanchez of a hit with a sliding catch behind first base to start the fifth. ... Johnson was 0 for 5 to fall to .157 for the season. ... The Giants lead all NL West teams with 151 home runs at Chase Fields.