CHICAGO -- Everybody needs a little pick-me-up now and then, even pitchers as good as the San Francisco Giants' Matt Cain.
Teammate Angel Pagan provided just that Sunday as he hit a line-drive RBI single to center field in the top of the ninth inning to break a 5-5 tie as the Giants went on to beat the Chicago Cubs 7-5 at Wrigley Field, taking two of three in the series.
The Giants also got a run-scoring single in the ninth from Marco Scutaro.
Pagan's game-breaking hit came off Cubs closer Carlos Marmol (2-3), who had gotten into trouble with a pair of walks. It scored pinch runner Gregor Blanco.
San Francisco, the first-place team in the National League West, improved to 76-58 while Chicago fell to 51-82.
"Timely hits," said Giants manager Bruce Bochy. "Obviously Pagan's was huge, and Marco's in the ninth."
Pagan, who played for the Cubs in 2006 and 2007, was 2-for-5 with two RBI out of the leadoff spot. He also was robbed of a couple of hits on good plays by Chicago fielders.
"He's a good player," Bochy said. "He's been a different player since he's been in the leadoff spot. That's a good piece of two-strike hitting there in the ninth."
Marmol, who has saved 16 in a row since early May, got into trouble with walks -- to Xavier Nady to start the inning and to Brandon Crawford with one out.
"It was a bad day," Marmol said. "You're not going to be perfect all the team. Hitters need to eat, too."
The Giants jumped to a 3-0 lead against Cubs left-hander Travis Wood in the third inning, with two of the runs unearned.
With one out and Nady on first base, Cain bunted toward first baseman Anthony Rizzo, whose throw to first pulled Darwin Barney off the bag for a throwing error, putting runners at first and second.
Pagan followed with an RBI single. After Scutaro popped out, Pablo Sandoval and Buster Posey each hit run-scoring singles. Wood wound up throwing 35 pitches in the inning.
The Cubs scored one in the third on an RBI single by David DeJesus. In the fifth, they scored four runs, capped by Alfonso Soriano's 25th home run of the season, a three-run blast to left-center field.
"When he gets a hold of a ball, I don't think it matters if the wind is blowing or not," Cain said. "I was trying to go away and it was really middle-middle, right at the belly button. It just came back over the plate."
It was Soriano's fourth season of at least 25 home runs with the Cubs, making him the 10th player in franchise history to do that.
"Just working hard to be a consistent player," Soriano said. "That's what I do. I know what I do, just working hard every day to be consistent."
Cain pitched five innings, giving up six hits and five runs while walking two and striking out six. Wood pitched 5 2/3 innings, allowing seven hits and four runs, two earned, while walking one and striking out two.
"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 Cain, whose record held at 13-5 with a 2.98 ERA. "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 going to 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."
NOTES: The schedule has not been kind to the Giants. They played a day game Friday at Wrigley Field after a night game Thursday in Houston. Remnants of Hurricane Isaac hit parts of the Chicago area over the weekend but spared Wrigley Field. The Giants play Arizona in San Francisco on Monday afternoon, and manager Bruce Bochy was glad there were no postponements. "This is a tough schedule to come in here, short night. If we hadn't gotten (Saturday's) game in, it would have really made it tough." ... The Cubs recalled right-handed reliever Miguel Socolovich from Class AAA Iowa. They claimed him off waivers from Baltimore on Aug. 23 after the Orioles had designated him for assignment. ... Outfielder Xavier Nady hit a three-run double Saturday in his first at-bat with the Giants, who purchased his contract before the game from Class AAA Fresno. Before Nady, the last Giant with three RBI in his first at-bat with the team was Candy Maldonado, against Houston on April 8, 1986. Nady was designated for assignment by Washington July 21. ... LHP Chris Rusin will be recalled from Class AA Tennessee by the Cubs to start Tuesday night in Washington. Rusin has made one start for the Cubs, losing 5-2 at Milwaukee on Aug. 21.