The Philadelphia Phillies almost pulled out a comeback victory after tying the game up in the ninth inning on Wednesday, but the San Francisco Giants were able to prevent getting swept with a walk-off victory in extra innings.

Andres Torres delivered the walk-off RBI for the Giants (20-14), bringing in Buster Posey, who replaced Brandon Belt to lead off the bottom of the 10th inning. Joaquin Arias sacrificed to send Posey to second base, then made it to third base on a wild pitch.

Barry Zito had the best outing for all the Giants' starters in the series. He performed well through seven innings, giving up just four hits and a home run to Kevin Frandsen, a former Giant.

Making up for the home run, Zito took advantage of the Phillies intentionally walking Guillermo Quiros in the sixth inning and singled to bring in Belt. That extended the Giants' lead to 3-1, earlier scoring on a Hunter Pence home run and Marco Scutaro bringing in Gregor Blanco.

Sergio Romo blew a save in the ninth inning. Chase Utley finally had his first hit of the game with runners in the corners, scoring Jimmy Rollins and reaching second base. Michael Young moved to third base and scored on a Delmon Young sacrifice fly to tie the game.

Earlier in the series, both Cliff Lee and Kyle Kendrick delivered dominating starting pitching performances for the Phillies, but roles were reversed by both teams. It was Philadelphia that didn't have many chances to score, going 1-5 with runners in scoring position and leaving three batters on base.