CHICAGO (AP) -- The feeling in the Giants' clubhouse these days is that they'll always find a way to win. And San Francisco has been especially good at doing just that on the road.
Angel Pagan had a tiebreaking single in the ninth Sunday as the Giants rallied to a 7-5 win over the Cubs, completing a 5-1 road trip to Houston and Chicago. Since the All-Star break, the NL West leaders are 19-6 away from home.
''We've been playing very well on the road,'' Giants manager Bruce Bochy said. ''These were hard-fought games that could have gone either way. It's all about trying to get a series. If you do that, you'll have a decent year.''
The Giants are more than decent right now. They're 76-58, a season-best 18 games over .500 after winning 12 of their last 16. And they have a favorable schedule in the final month. San Francisco plays the second-place Dodgers six more times, but L.A. is the only team left on the Giants' slate that currently has a winning record.
''There's a feeling in the dugout, that even when things aren't going right, we still feel like we're in the game,'' said Giants starter Matt Cain, who lasted only five innings Sunday, matching his shortest outing of the season.
''I've been on teams before where you're down runs and you don't feel like you're in it anymore. This team feels like no matter what the score is, they're gonna keep going out and find ways to score runs. It's a good feeling to have because you never feel like you're out of the game.''
Santiago Casilla (6-5) pitched an inning to get the victory Sunday and Javier Lopez got the final two outs for his sixth save in eight chances.
San Francisco carried a 3-1 lead into the fifth but Darwin Barney scored on right fielder Hunter Pence's error and Alfonso Soriano hit a three-run drive off Cain for his 25th homer, putting the Cubs ahead 5-3.
Brandon Belt tripled in Xavier Nady in the sixth and scored the tying run on Manuel Corpas' wild pitch. Then the Giants took advantage of a bout of wildness by Carlos Marmol to grab the lead in the ninth.
Nady led off with a four-pitch walk and pinch-runner Gregor Blanco stole second with one out. Brandon Crawford then walked and Pagan followed with a single to center. Marco Scutaro added another RBI single to give the Giants a two-run cushion.
''I got up in the right situation to put the team on top, and I got it done,'' said Pagan, who once played for the Cubs, as did Nady.
''For us, we're trying to grind at-bats the best we can and make the at-bat as tough as possible,'' Pagan added.
Marmol (2-3) was 1-0 with a 1.08 ERA in his previous 17 appearances.
''Just a bad day. You're not going to be perfect all year long,'' said Marmol, who lost the closer's job earlier this season and then got it back.
The Cubs could be on their way to 100 losses as they try to mix in young players and build for a future that looks a long way off. Manager Dale Sveum said he hopes his players take notice of how the Giants play the game.
''That's a championship-type baseball team that we have to somehow put together, too,'' he said.
Cain was charged with five runs and six hits. The ace right-hander was 3-0 with a 1.82 ERA in his last four starts.
Chicago starter Travis Wood surrendered seven hits and four runs - two earned - in 5 2-3 innings. The left-hander is 0-8 with a 6.33 ERA in his last 10 starts.
San Francisco got three in the third, aided by an error on first baseman Anthony Rizzo, who threw wide to first on Cain's sacrifice bunt, putting runners at first and second. Pagan, Pablo Sandoval and Buster Posey followed with RBI singles.
Cain missed Barney's comebacker to start the bottom half of the inning. Barney, credited with an infield single, moved up on Wood's sacrifice and scored on David DeJesus' sharp single to make it 3-1.
And the Cubs practically repeated that sequence for their second run in the fifth when Barney singled, advanced on Wood's sacrifice and scored when Pence bobbled DeJesus' single.
Luis Valbuena then walked and after a fielder's choice, Soriano drove a pitch to deep left center. Soriano now has nine seasons with at least 25 homers.
NOTES: Soriano leaped into the ivy to catch Cain's long fly ball in the fourth. ...Bochy said it might help Pablo Sandoval to drop a few pounds. ''It's an ongoing issue, obviously. Something he's been battling. He showed last year that he's a better hitter when his weight is down,'' Bochy said. ''We'd like to get him down a little bit, but it's hard in September with the focus. This winter he needs to get back on the program he had a few years ago.''