PHILADELPHIA — Matt Cain pitched into the eighth inning to outduel Cole Hamels and lead the San Francisco Giants to a 2-1 win over the Philadelphia Phillies on Wednesday night.

PHILADELPHIA — Matt Cain pitched into the eighth inning to outduel Cole Hamels and lead the San Francisco Giants to a 2-1 win over the Philadelphia Phillies on Wednesday night.

The NL West-leading Giants won for the third time in four games.

San Francisco scratched out two runs to deny Hamels (12-6) his NL-best 13th win.

San Francisco could have Tim Lincecum back on the mound for the series finale today. The floppy-haired ace was scratched from his start Tuesday because of an illness, but manager Bruce Bochy was hopeful he would start the finale.

With Lincecum out, Cain (9-6) had his start moved up a day and again quieted Philadelphia's bats. Cain pitched seven shutout innings and beat Hamels in Game 3 of last year's NL championship series.

Cain allowed an unearned run and four hits before he was yanked when pinch-hitter Ross Gload reached on catcher's interference leading off the eighth. Javier Lopez got three outs and Brian Wilson finished for his 32nd save and a combined four-hitter. The Giants have won 12 of 17.