SAN FRANCISCO -- If there was any question whether Pablo Sandoval's power stroke on Wednesday was a blip on the screen he proved on Thursday it was no fluke in the first inning.
Then he did it again three innings later.
Sandoval hit home runs from each side of the plate for the first time in his career as the Giants completed a four-game sweep of the Rockies with a 9-2 win.
"I've been going up there just trying to hit the ball, relax, support my team," Sandoval said. "I'm confident and I feel great."
The pair of long balls came less than 24 hours after Sandoval homered for the first time in 161 at-bats on Wednesday, the second longest homerless drought of his career. The Giants have been waiting for Sandoval's power stroke to return. He was showing signs of heating up with a stretch of 9-for-24 (.375) in the five games leading into Thursday.
"I think once he hit the one (Wednesday) night, it relaxed him," Giants manager Bruce Bochy said. "He doesn't have to try to hit home runs. He knows he's strong enough to hit the ball out of the park. Those swings were not out of control. He got good pitches."
By winning for the eighth time in nine games, San Francisco reduced its magic number to clinching its second division title in three years to four, pending the outcome of the Dodgers game at Washington Thursday night.
"It's a club with a lot of character," Bochy said. "They come out every day, they're loose, they're keeping their focus and they're having fun with this."
The Rockies, meanwhile, lost for the 14th time in 18 meetings with the Giants this season and capped a seven-game road trip with their sixth straight loss. San Francisco moved a season-high 24 games over .500 and won for the ninth straight time with veteran left-hander Barry Zito starting.
The Giants broke the game open with a two-out, six-run fourth inning.
With the score tied 2-2, Hector Sanchez and Xavier Nady led off the fourth with singles, and after a fly out, Zito's sacrifice bunt moved them up a base. Rockies starter Jorge De La Rosa uncorked a wild pitch to plate Sanchez, and the flood gates opened.
Angel Pagan walked before Colorado third baseman Chris Nelson made a good stop of a Marco Scutaro grounder, but threw wildly to first, allowing the second run of the inning to score and sending De La Rosa to the showers.
De La Rosa, 31, was making his first appearance in a big league uniform since May 24, 2011, a span of 264 games missed since last season. A torn ulnar collateral ligament led to Tommy John surgery and a long recovery that included seven rehab starts in the minors.
"It was good for me to get back out there since it was such a long time," De La Rosa said. "I felt good out there, but I have to get stronger."
Sandoval supplied the big blow in the inning when he greeted Rockies reliever Edgmer Escalona with a three-run home run into the right field seats on an 0-2 pitch. Sandoval has 12 homers for the season, and he went deep twice in the same game for the fifth time in his career.
"Sometimes you go up there and have the feeling everything is going your way," Sandoval said.
The Giants weren't done, however, as Buster Posey deposited his 23rd homer of the season into the left-center field bleachers to cap the rally.
The hosts had taken an early 1-0 lead on Sandoval's two-out homer in the first. The Rockies answered in the second inning when Wilin Rosario collected the first of his three straight singles, stole second and scored on Jonathan Herrera's two-out single to left.
Colorado's rookie catcher Rosario, drawing his first start at first base, misjudged a high pop with two outs in the third off of Sandoval's bat that fell and enabled Pagan to score a tie-breaking run. Pagan had reached with a one-out double down the line in left field that Colorado's Andrew Brown failed to reach.
"It was a good experience but a bad result," Rosario said of playing the unfamiliar position. "I didn't read the wind right."
The visitors briefly tied the game again in the fourth with a single run off of Zito. Brown led off with a double and scored when De La Rosa stroked a two-strike single to center after failing to put down a bunt on the first two pitches.
Zito (13-8) earned the win, allowing two runs and 10 hits in 5 2/3 innings. He walked one and struck out six.
"When he's pounding the strike zone and has command of his pitches he's going to have a good game," Bochy said. "He's smart, he knows what he's doing out there. He has more pitches to work with.
"He's really locked in out there and has great focus," he added. "I know he hates it when I come out to get him; he wanted to get that last out. But he'd gone far enough."
NOTES: Bochy wore a 49ers hat in pregame to poke fun at the NFL's threat to fine 49ers quarterback Alex Smith for wearing a Giants cap. "We're just having a little fun with this," Bochy said. "We want to show our support for the 49ers just like Alex Smith shows his support for us." Rockies left fielder Carlos Gonzalez left Thursday's game in the second inning. He missed two recent games due to a hamstring injury. Matt McBride replaced Gonzalez in the No. 3 spot in the order. ... The Giants open a three-game series against visiting San Diego on Friday when Ryan Vogelsong (12-9) is set to oppose Casey Kelly (2-1) for the Padres. ... The Rockies head to Denver to play their final homestand of the season. Drew Pomeranz (1-9) is scheduled to pitch against Arizona's Wade Miley.