Giants 2, Phillies 1

Hunter Pence collected three hits and sparked a ninth-inning rally as visiting San Francisco survived a wild finish to take two of three from Philadelphia.

Following eight scoreless innings from starter Cole Hamels, Jonathan Papelbon (2-1) gave it away in the ninth on four consecutive singles by the Giants. Pence, a former Phillie, opened the frame with an infield hit and Brett Pill moved him to third before Roger Kieschnick and Joaquin Arias each delivered run-scoring singles.

Sergio Romo almost returned the favor in the bottom half after Delmon Young reached on an error, Cody Asche got his first major-league hit on a bunt single and John Mayberry Jr. loaded the bases with none out after being hit with a pitch. But Romo induced two flyouts and a grounder to hold on for his 25th save.

Matt Cain (7-6) gave up one run on six hits and struck out seven in eight innings for the Giants, who scored a major league-low 78 runs in July and were in danger of getting shut out for the fourth time in 13 games since the All-Star break. Buster Posey and Arias had two hits apiece as San Francisco has won back-to-back games following a five-game slide.

Laynce Nix singled to right with two outs in the fifth, moved to second on another single by Carlos Ruiz and scored on Hamels’ opposite-field RBI single down the left field line to give the Phillies a 1-0 lead. The Giants put a runner on base with one or no outs in the fifth, sixth and seventh innings, but could not solve Hamels until he departed after 103 pitches.

GAME NOTEBOOK: Ex-Phillies closer Brad Lidge formally announced his retirement Thursday. The hard-throwing reliever spent four years with Philadelphia from 2008-11, saving 100 games in that span. … Posey, who went 2-for-4 against Hamels, is 7-for-11 with a homer and four doubles in his career against the left-hander. … Philadelphia OF/1B Darin Ruf drew a walk in the seventh, extending his consecutive-games streak of reaching base to 29.

Final1st2nd3rd4th5th6th7th8th9thRHE
San Francisco GiantsGiants0000000022111
Philadelphia PhilliesPhillies000010000170
WP:Matt Cain (SF)
LP:Jonathan Papelbon (PHI)
Season Series
PhiladelphiaStatsSan Francisco
3-3Vs3-3
.254Batting Average.274
4.2Runs / Game3.7
7Home Runs4
4Errors4