DENVER -- A three-run rally isn't usually cause for celebration.
For the San Francisco Giants and their slumping offense, however, scoring three runs in one inning Sunday was a long time coming and most welcome.
The Giants parlayed that fifth-inning uprising, which was aided by a costly error, into a 5-2 win over the Colorado Rockies that broke a six-game losing streak.
The skid was San Francisco's longest since a seven-game slide from June 26-July 2, 2010. The Giants also ended a seven-game road losing streak, improving to 15-27 away from AT&T Park.
Hunter Pence hit a two-run homer in the fifth right after the Giants scored the inning's initial run on first baseman Jordan Pacheco's throwing error.
"We got a break, and it seemed like it relaxed the guys a little bit," Giants manager Bruce Bochy said. "It's a game we've been looking for for a while, and we know it -- a win. It's going to make the flight ahead to Cincinnati a little better."
Madison Bumgarner (8-5) allowed one run in seven innings -- Carlos Gonzalez hit his 22nd homer in the sixth -- marking the fifth straight start he has yielded three or fewer runs. In those games, Bumgarner is 4-1 with a 2.18 ERA.
Colorado's Michael Cuddyer extended his franchise-record hitting streak to 27 games with a two-out single in the eighth. After striking out and grounding out twice against Bumgarner, Cuddyer hit a one-hopper that went off the hand of reliever Sandy Rosario and into center field.
"What helped me from being anxious was we needed baserunners in that situation," Cuddyer said. "I was taking, which helped me see the first slider. Then I saw his fastball, second pitch. I felt good after the two pitches, and then I squeaked one up the middle."
The Giants scored one run in each of their first two losses in the series Friday and Saturday, and they totaled just 18 runs in their previous nine games, scoring two or fewer runs in seven of the contests. However, they took advantage of a ragged 92-pitch start by Drew Pomeranz in his 2013 Rockies debut.
Pomeranz (0-1) gave up seven hits, including Buster Posey's solo homer in the third as well as Pence's two-run shot, four walks and four runs in 4 1/3 innings.
"The big mistake to Pence really hurt me there," Pomeranz said. "Buster hit a pretty good pitch. My command wasn't what it has been. I haven't been pitching like that. I'm obviously very disappointed, not making it deep into the game like I would like to."
Andres Torres began the fifth-inning rally with a single, and Tony Abreu doubled to deep center. Posey, who homered in the third, grounded to second, but Pacheco threw the ball into left field while trying to get Abreu, who was scampering back to second.
Pence followed with his 13th homer to break the Giants' string of 18 consecutive hitless at-bats with runners in scoring position. Four of those 18 at-bats came earlier Sunday.
"We've been looking for a big hit for a while to give us a little cushion," Bochy said. "I think it took some pressure off some guys, because they're trying hard. They're fighting to get out of this. Hopefully, this will settle guys down, and we'll start getting better at-bats with men in scoring position."
The Giants added a run in the seventh when Manuel Corpas walked Juan Perez with two out. Perez scored when Guillermo Quiroz dropped a single into short right field, the ball landing between second baseman DJ LeMahieu and right fielder Cuddyer.
The Giants finished 10-17 in June, their first losing month since August 2011 and their worst record in a month since they went 8-16 in July 2008. Yet, the Giants, who are 39-42, lost just two games in the National League West standings and are three games behind the first-place Arizona Diamondbacks.
"We're fortunate," Bochy said. "I think every team in this division can say that. We're fortunate to have a month like this and still be somewhat in this thing. It's early, there's so much baseball left, but it can get away from you in June. That's what you have to remind yourself."
NOTES: Rockies CF Dexter Fowler was not in the lineup for the fifth straight game due to right wrist soreness. He said the wrist was better and with an off day Monday hopes to play Tuesday. ... Rockies RHP Rob Scahill was optioned to Triple-A Colorado Springs to clear a roster spot for Pomeranz. In three different stints with the Rockies this season, the last of which began May 29, Scahill is 0-0 with a 4.26 ERA in 13 games. ... The Rockies' search for a right-handed bat off the bench led them to sign veteran OF Xavier Nady, 34, to a minor league contract. He will report to Colorado Springs. The Kansas City Royals released Nady from Triple-A Omaha, where he hit .310 with 11 homers and 43 RBIs in 70 games but had a chance to leave if another opportunity arose with a major league club. ... Posey started at first base for the second straight game and eighth time this season. Posey played first base at the expense of Brandon Belt, whom Bochy said he didn't feel comfortable putting in the spacious left field at Coors Field