SAN FRANCISCO (AP) - Jason Hammel's first start with the Oakland Athletics didn't exactly go as planned.
The right-hander labored through five innings and had a weird cramp in the thumb on his glove hand as Oakland's six-game winning streak ended with a 5-2 loss to the San Francisco Giants on Wednesday night.
Hammel said his left thumb, which looked disjointed when it cramped up in the fifth, was fine afterward. He was bothered more by his performance.
''Tonight was a grind and they grinded me pretty good,'' he said.
Hammel, acquired by the A's along with fellow right-hander Jeff Samardzija from the Chicago Cubs last week for three top prospects, had anything but a clean opener with Oakland. He left after giving up six hits and three runs - two earned - in five innings. He struck out three and walked three.
Stephen Vogt homered and Jed Lowrie had an RBI single for Oakland's only runs.
''I thought he pitched awesome. There were a couple of balls that didn't go our way,'' Vogt said. ''They made him throw a lot of pitches. He's not new to them. He's new to us. I'm sure they had a good game plan for him.''
Hunter Pence homered and drove in two runs, and Matt Cain tossed six strong innings as the Giants got back on track at home. San Francisco, which had lost 20 of 27 overall, moved back into first place in the NL West, percentage points ahead of the Dodgers.
''If you look at how things have gone, you find that amazing,'' Giants manager Bruce Bochy said. ''It's all from the good work that happened earlier. We've got to get back on track.''
For one night, they did.
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 San Francisco start to turn things around.
Santiago Casilla got three quick outs for his fourth save.
The A's shut down the Giants 5-0 and 6-1 in the first two games of the Bay Bridge Series in Oakland and looked every bit like the team with the best record in baseball while doing it.
Back in the comforts of glitzy AT&T Park, though, the Giants offense finally showed signs of life. San Francisco finished with 10 hits and took advantage of most of its scoring opportunities.
With one out in the second inning, Yoenis Cespedes bobbled Joe Panik's single in left field for an error. By the time the strong-armed Cespedes corralled the ball and threw home, Gregor Blanco had already crossed the plate.
Buster Posey's RBI single gave the Giants a 2-0 lead in the third.
Vogt homered leading off the fourth for Oakland, sending a slider from Cain over the stands in right and onto the walkway outside the ballpark for his third long ball this season.
Pence came back with his own long ball in the fourth to put the Giants up 3-1. It was Pence's 12th home run and first since June 21 at Arizona.
''It was a pretty clean game,'' Posey said.
While the Giants finally got the bats going, Cain kept finding ways to minimize the A's rallies.
The right-hander got Coco Crisp to ground out with two runners on in the fifth, which came after Cain misfired to second base on a potential double-play ball earlier in the inning. And after Lowrie's two-out single sliced San Francisco's lead to 3-2 in the sixth, Cain got Derek Norris to ground out, stranding two runners.
Oakland got a brief scare in the fifth when Hammel's left thumb somehow bent awkwardly in the middle of Blanco's at-bat. An A's trainer worked on the thumb for several minutes, then the pitcher got Blanco to ground out.
Pence hit an RBI single in the sixth before lefty Eric O'Flaherty's wild pitch helped the Giants score another run to go ahead 5-2.
Oakland's offense was kept quiet the rest of the way. Jeremy Affeldt, Sergio Romo and Casilla each pitched one perfect inning of relief.
NOTES: Vogt extended his hitting streak to a career-high nine games. ... The Giants optioned OF Juan Perez to Triple-A Fresno after the game. INF Ehire Adrianza will be activated from the disabled list Thursday. ... Left-hander Scott Kazmir (10-3, 2.53 ERA) starts for the A's against RHP Tim Hudson (7-5, 2.53 ERA) in Thursday's series finale.