DENVER -- In a classic pitching duel befitting of a pair of teams battling each other in a tight race, the Rockies treated a sold-out Coors Field to a come-from-behind 4-2 victory Sunday, giving them a three-game lead over the Giants in the National League Wild Card standings and trimming Colorado's NL West deficit back to 3 1/2 games.

"It's fairly safe to say that the game lived up to its billing, with two of the brighter young pitching stars on the charts," Rockies manager Jim Tracy said. "One guy already has a Cy Young Award. This guy for us isn't too far behind."

The Rockies' guy was Ubaldo Jimenez (12-9), and he held up his end of the bargain, extending his winning streak to six games. He gave up a two-run homer on a mistake pitch to Edgar Renteria and scattered six hits through eight innings, striking out nine while walking two. It was his ninth consecutive start going at least six innings and giving up no more than three runs and his 22nd straight start pitching six or more innings.

Jimenez set the tone early and established a winning approach against the NL West rivals by besting the Giants' leadoff hitter in the game's first action.

"In the first inning, the first hitter I faced, I was able to strike him out," Jimenez said of his showdown with Eugenio Velez. "I thought tonight was going to be a good day."

The Renteria homer in the second inning was Jimenez's only mistake, and against a pitcher like Tim Lincecum, there is little margin for error.

"He's one of the best pitchers out there," Jimenez said. "You know you have to be almost perfect to beat him. When I gave up the two runs, I knew it was going to be hard to come back, but I have to keep at it."

The Rockies couldn't touch Lincecum through the first five innings, going hitless against the reigning Cy Young Award winner and only reaching base through Lincecum's own doing as he walked three and hit one batter. Todd Helton broke up the no-hit bid with one out in the sixth, sending a hard grounder up the middle. Renteria got a glove on it, but had no chance at fielding it cleanly. Lincecum issued his fourth walk of the game to Brad Hawpe with two out in the inning, and Ian Stewart knocked an RBI single to right to plate Helton in a close play at home.

"He's definitely capable [of throwing a no-hitter every time]," Helton said. "His offspeed stuff was dirty today, and he set it up with his fastball."

Despite his stifling of the Rockies bats early, Lincecum ran his pitch count up to 101 by the end of the sixth, and the Rockies continued their assault on him in the seventh, with .174-hitting Omar Quintanilla coaxing a leadoff walk and Jimenez dropping a two-strike sacrifice to move him to second before Seth Smith launched a two-run tater 451 feet into the second deck in right field to put the Rockies ahead, 3-2.

"He left a changeup up and over the plate, and I was able to get the barrel to it," Smith said. "I talked to Groove [hitting coach Don Baylor] before that at-bat. I'd kind of got out of my game plan, because he was throwing so much offspeed stuff, and I was trying to pick it up, but he can sneak a fastball by you. So you have to stay aggressive to the fastball, and that's when you can keep your weight back on the offspeed and still get to it."

Lincecum chalked it up to another mile-high moment, though the previous night's 14-11 Rockies win was more in the vein of a vintage Coors Field slugfest.

"Sometimes that's what things do here," Lincecum said of the hanging changeup. "Balls do weird things, and the changeup was left up and it cut right back to his bat."

The leadoff walk from Quintanilla effectively ended Lincecum's stretch of effective wildness, allowing the Rockies to carry over their momentum from the sixth. The light-hitting infielder was in the game as a result of some poor numbers against Lincecum from both Clint Barmes, the Rockies' regular second baseman, and third baseman Stewart, who often hits next to Barmes in the lineup.

"Barmie and Stewart were 1-for-20 and 11 strikeouts [against Lincecum], and I did not like the dynamic of 1-for-20 with 11 strikeouts in the six- and seven-spot in the order," Tracy said.

The Giants threatened in the top of the eighth, when Velez doubled to center to lead off the inning. Center fielder Dexter Fowler made a great play to get to the ball and hold Velez to a double, and a groundout to second from Randy Winn brought the tying run to third with Pablo Sandoval at the plate and one out.

"[Catcher Chris] Iannetta came to me and said, 'You have to bounce this pitch,'" Jimenez said of their strategy against Sandoval. "He's one of the most aggressive guys out there. Every time he swings, he makes contact; it doesn't matter where the pitch is. That's the way he is. He's aggressive, he chases everything, but he makes contact."

Jimenez's curve was an inch or two off the ground, but Sandoval reached down for it and grounded out to Helton at first, freezing Velez on third and allowing Jimenez to escape the inning without letting the tying run home.

The Rockies put an insurance run on the board in the eighth after Sergio Romo hit the pinch-hitting Barmes with the bases loaded. Jimenez gave way to Huston Street for the final frame, and Street secured his 33rd save of the season.