SAN FRANCISCO (AP) -- Matt Cain had no problem working out of jams when San Francisco's defense committed errors in three innings.
The Giants ace was even more impressive after getting himself into trouble.
Cain pitched out of a two-on, no-outs jam in the seventh inning to stay unbeaten in his last nine starts and helped himself at the plate with two hits and an RBI while leading San Francisco to a 6-0 win over the Arizona Diamondbacks on Wednesday night.
''When there's an error, (Cain) doesn't get distracted,'' Giants manager Bruce Bochy said. ''If anything he tries to pick them up. That's what he's so good at. He has that great focus you like out there and he did it again tonight.''
Cain (16-5) scattered four hits and had six strikeouts in his next-to-last start in the regular season. Two of the strikeouts came in the seventh after he allowed a leadoff double to Paul Goldschmidt and a single to Gerardo Parra.
It was exactly the type of outing San Francisco needed from its ace after two-time NL Cy Young Award winner Tim Lincecum was knocked around by the Diamondbacks a day earlier.
Cain, who hasn't lost since Aug. 6, lowered his ERA at AT&T Park to 2.03 despite the three errors behind him - two by shortstop Brandon Crawford.
''That's kind of what you want to do as a pitcher when funky plays happen behind you,'' Cain said. ''It's the same things if we make bad pitches. We're looking for those guys to pick us up.''
Cain tied lefty Madison Bumgarner for the team lead in victories, marking the first time since 1993 that the Giants have had two 16-game winners.
It's San Francisco's first victory since clinching the NL West for the second time in three years.
The Giants were the fifth NL team to pitch a shutout Wednesday. The last time there were at least five shutouts in the same league on the same day was Sept. 18, 2003, in the NL, according to STATS LLC.
Parra and Miguel Montero had two hits apiece for Arizona, which only managed to get one runner past second base while losing for just the third time in 10 games.
''Cain shut us down,'' Arizona manager Kirk Gibson said. ''He could throw any pitch at any time to any place he wants. We didn't swing the bats well at all.''
Guillermo Mota, Jeremy Affeldt and Dan Otero combined for two innings to complete San Francisco's 14th shutout of the season.
The Giants scored twice off Diamondbacks starter Wade Miley (16-11) in the third on an infield hit by Sandoval and an RBI single from Buster Posey.
Posey joined Walker Cooper (122 in 1947) and Dick Dietz (107, 1970) as the only other catchers in franchise history to reach 100 RBIs in a season. The achievement comes after Posey missed most of 2011 with a broken leg following a collision at home plate.
''It's been really pretty incredible how he's bounced back from that injury,'' Bochy said. ''He's a special talent. That's quite a milestone, especially for a catcher. Those guys have to take a lot of time off and they get banged up pretty good back there.''
Miley, Arizona's prized left-hander who was attempting to become the first rookie in the NL to reach 17 wins since Cincinnati's Tom Browning in 1985, didn't last much longer.
Belt tripled leading off the fourth and scored on Scutaro's single. Crawford, who walked following Belt's hit, later scored on Sandoval's fielder's choice grounder to give the Giants a 4-0 lead.
Scutaro also doubled in the eighth and has the longest active hitting streak in the majors.
Miley lasted just four innings, matching the shortest outing of his career. He allowed three earned runs with three strikeouts and three walks while losing to the Giants for the second time in two weeks.
Cain singled and scored in the third then reached on an infield single in the fifth to drive in Hunter Pence and make it 5-0. Pence reached on a throwing error by Diamondbacks third baseman Cody Ransom.
Goldschmidt doubled leading off the seventh and moved to third on Parra's single, but Cain worked out of the jam without much trouble. He struck out Ransom and John McDonald then got pinch-hitter Jason Kubel to ground out to third.
Notes: Cain has gone at least seven innings without allowing an earned run in five of his 31 starts this season. ... Bochy said the team will decide by Thursday whether to include suspended OF Melky Cabrera on its postseason roster. ... LHP Barry Zito (13-8) goes after his fourth consecutive win for San Francisco in the series finale. LHP Patrick Corbin (6-7) takes the hill for Arizona.
- San Francisco
- Matt Cain
- Arizona Diamondbacks