DENVER - Buster Posey homered, doubled twice and drove in four runs, rallying the San Francisco Giants past the Colorado Rockies 12-7 on Tuesday night.

Posey's solo homer in the sixth keyed a three-run burst as the Giants raced back from a 7-1 deficit to remain on the heels of the Los Angeles Dodgers in the NL West. He hit a two-run double in a six-run seventh.

Hunter Pence had two hits to extend his hitting streak to 15 games for the Giants.

George Kontos (4-0) kept the Giants in striking distance with 1 2-3 scoreless innings until the bats could heat up.

When they did, the Rockies couldn't cool them off, as starter Jordan Lyles allowed six runs in 6 1-3 innings before giving way to reliever Matt Belisle (4-7), who surrendered another four before being pulled after getting just one out.

Down six runs in the sixth, the Giants began to climb back into the game with Posey's 19th homer of the season and later a two-run shot from Andrew Susac.

A seventh inning that featured five extra-base hits began with pinch-hitter Matt Duffy grounding out. San Francisco had a two-run double by Posey, an RBI single from Pence, a run-scoring double by Gregor Blanco that gave the Giants the lead, an RBI double from Susac and a run-scoring triple from Brandon Crawford.

The inning ended with the pinch-hitter Duffy striking out.

Josh Rutledge had a two-run triple in the third and DJ LeMahieu followed a two-run homer for the Rockies, who have the worst record in the National League.

Lyles kept the Giants bats at bay with a new grip on his changeup until unraveling in the sixth.

Yusmeiro Petit was hit hard, allowing six runs in four innings but was let off the hook with a no-decision by his team's comeback. The righty shut down the Rockies when he faced them last week.

TRAINER'S ROOM

Giants: OF Michael Morse suffered a strained oblique in batting practice Monday. Manager Bruce Bochy said he expects Morse to return soon.

Rockies: OF Michael Cuddyer (strained left hamstring) said he's healthy and will be ready to come off the disabled list when he's eligible next week. In his down time, Cuddyer said he's drafted four different fantasy football teams.

UP NEXT

Giants: RHP Ryan Vogelsong (8-9, 3.73) has given up eight earned runs in 6 1-3 innings against Colorado this season.

Rockies: RHP Christian Bergman (1-2, 5.74) didn't give up a hit until the fifth in his last start at Arizona. He went 5 1-3 innings in a no-decision.