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.