CHICAGO (AP) -- Jeff Samardzija keeps getting more experience in his first season as a starting pitcher, and Friday was a positive step.
The Cubs right-hander rebounded after allowing three runs in the first three innings in Chicago's 5-3 victory over the Colorado Rockies.
Joe Mather took advantage of a rare start with a go-ahead single during a three-run rally in the eighth inning and the Cubs ended a four-game losing streak.
The Rockies had matched a season best with a five-game winning streak.
''There have been times I had good stuff and it's gone smoothly and then I come out early like that and scuffle and really not have fastball command or a slider all game,'' Samardzija said.
''To get through the end of seven innings felt really good, just felt like a starting pitcher, consciously understanding what's there and not there,'' he said.
Samardzija gave up two earned runs and six hits in seven innings, striking out seven.
Chicago trailed 3-2 going into the eighth before Brett Jackson led off with his second homer of the season.
Pinch hitter Luis Valbuena doubled with one out and Mather, batting in the leadoff spot usually occupied by David DeJesus, followed with an RBI single against reliever Matt Belisle (3-5).
Mather later scored on reliever Matt Reynolds' throwing error to first on Anthony Rizzo's grounder.
James Russell (6-1) got two outs for the win and Carlos Marmol closed for his 16th save.
The Rockies scored in the first on an error by shortstop Starlin Castro, a single by Jordan Pacheco and a wild pitch.
Chris Nelson made it 2-0 in the second with his sixth homer. Carlos Gonzalez led off the third with his 21st homer and first since July 23.
''He was able to settle down,'' Cubs manager Dale Sveum said of Samardzija. ''He's grown a lot, especially in the last four, five, six starts. You start seeing a guy who's learning what to do in situations, how to get quicker outs.''
The Cubs were hitless until Alfonso Soriano led off the fifth with his 23rd home run, connecting against Drew Pomeranz. Welington Castillo homered later in the inning to cut the Rockies' lead to 3-2.
Pomeranz left after the fifth. The home runs were the only hits he allowed.
''I felt great today,'' he said. ''Velocity was good, location was good. I think Castillo hit that ball pretty good, but I didn't think Soriano's ball was going out.''
The Cubs are 5-17 in August.
''You leave them hanging around like that and they have a chance,'' Rockies manager Jim Tracy said. ''We weren't able to do much offensively. We hit two balls out of the ballpark with nobody on. That's pretty much what we did.''
NOTES: Sveum opted for Mather to lead off against LHP Pomeranz, giving DeJesus a day off. ''We'll keep everybody else in their slot and see what happens,'' he said. ''We haven't seen many lefties in a while, so we'll give Joe a few at-bats.'' ... Pomeranz was the first lefty starter the Cubs faced since Aug. 8 in a 2-0 loss to San Diego's Clayton Richard ... Colorado 3B coach Rich Dauer will be inducted into the Baltimore Orioles Hall of Fame on Saturday. He played for the 1983 World Series champion Orioles ... Rockies OF Dexter Fowler (ankle) is off crutches and will likely not be in the lineup during the Cubs series. He could possibly pinch hit Sunday, Tracy said. ... Colorado INF Josh Rutledge (quadriceps) is doing better, but is heavily taped and progressing slowly and won't be pushed, Tracy said.