Updated

Hunter Pence's three-run homer in the eighth inning lifted the San Francisco Giants over the Colorado Rockies, 9-6, in the rubber match of a three-game set at AT&T Park.

Trailing 6-4, the Giants loaded the based with no outs in the eighth. Melky Cabrera ripped a grounder up the middle and a diving Josh Rutledge got his glove on the ball but was unable to corral it, allowing Brandon Crawford to score. Buster Posey followed with a game-tying sacrifice fly before Pence ripped a fastball into the seats in left-center field.

"It's not really about me, it's about the win and that was huge," remarked Pence. "A lot of things came together for that opportunity to come up and I think everyone enjoyed it on our team."

Cabrera had two hits and three RBI while Buster Posey, Brandon Belt and Ryan Theriot each drove in a run for the Giants, who won for the fourth time in six games.

Clay Hensley (4-3) picked up the win after allowing one run on three hits over two innings of relief. Javier Lopez and Sergio Romo combined for a perfect ninth to secure the win.

Eric Young went 3-for-5 with an RBI double, while Rutledge, Chris Nelson and D.J. LeMahieu each doubled and knocked in a run for the Rockies, who fell to 30 games under .500 (41-71).

Matt Belisle (3-4) gave up four runs in the eighth to absorb the loss.

"We did everything we could do to try to win the game...played with heart, played with energy," said Rockies manager Jim Tracy.

The Giants scored three in the first to take an early lead. Cabrera ripped a two-run single up the middle and Posey followed with a base hit, putting runners on the corners for Belt, who scored Cabrera with a single.

The Rockies answered with two in the third and one in the fourth to tie the game. LeMahieu singled to start the third, moved to second a sacrifice bunt, then scored on Young's double. Rutledge followed with a double to push Young across.

In the fourth, Willin Rosario walked, moved to third on Nelson's double then scored on Alex White's sacrifice fly.

But the Giants took he lead in the fifth when Theriot doubled to score Belt.

The Rockies would add two in the sixth and one in the seventh to take a 6-4 lead.

In the sixth, Pacheco singled, stole second, then scored on LeMahieu's double. Torres followed with a base hit to plate LeMahieu.

Pacheco's sacrifice fly in the seventh scored Dexter Fowler.

Game Notes

Barry Zito started for San Francisco and gave up four runs on seven hits and struck out three over 5 1/3 innings...Posey walked three times. He leads the National League in RBI since the All-Star break with 33...The Giants won for the third time this season when trailing after eight innings...White started for the Rockies and gave up three runs on seven hits over four innings.