Giants spoil Jason Hammel's debut with Oakland, beating Athletics 5-2 in San Francisco

San Francisco Giants' Hunter Pence, right, is congratulated by third base coach Tim Flannery after Pence hit a home run off Oakland Athletics' Jason Hammel in the fourth inning of a baseball game Wednesday, July 9, 2014, in San Francisco. (AP Photo/Ben Margot) (The Associated Press)

San Francisco Giants' Buster Posey swings for an RBI single off Oakland Athletics' Jason Hammel in the third inning of a baseball game Wednesday, July 9, 2014, in San Francisco. (AP Photo/Ben Margot) (The Associated Press)

Hunter Pence homered and drove in two runs, Matt Cain tossed six strong innings and the San Francisco Giants spoiled Jason Hammel's debut for Oakland with a 5-2 victory over the Athletics on Wednesday night.

Cain (2-7) allowed two runs and five hits for his first win since May 15 against the Miami Marlins. He struck out four and walked two to help the Giants snap Oakland's six-game winning streak.

Hammel, acquired by the A's along with fellow right-hander Jeff Samardzija from the Chicago Cubs last week for three top prospects, disjointed the thumb on his glove hand but stayed in the game. He left after giving up six hits and three runs — two earned — in five innings, striking out three and walking three.

Stephen Vogt homered and Jed Lowrie had an RBI single for Oakland's only runs.