Carlos Marmol's long run of success came crashing to an end Sunday.

Called upon to pitch the ninth in a tie game, he gave up two walks and two RBI singles as the San Francisco Giants rallied for a 7-5 victory against the Chicago Cubs.

"Just a bad day. You're not going to be perfect all year long," said Marmol (2-3), who lost the closer's job earlier this season and then got it back. He had a 1.08 ERA in his previous 17 games, dating back to July 14.

After his performance Sunday in the non-save situation, Marmol's ERA jumped from 3.83 to 4.15.

"I played behind him for a year. He was a little erratic, so you have to be patient," said the Giants' Xavier Nady, an ex-Cub who started the ninth inning with a walk. "Fortunately he didn't have his best stuff today. He's always a tough at-bat, you're just trying to get on base."

After the two walks, Angel Pagan had the tiebreaking single and Marco Scutaro added another RBI single for the Giants, who are now 19-6 on the road since the All-Star break.

The Cubs got a three-run homer Sunday from Alfonso Soriano that gave them a 5-3 lead in the fifth against Matt Cain, but couldn't hold on.

It was Soriano's 25th homer — the ninth time he's reached that plateau in his career.

"I play this game with my heart. Anything I do on the field is because I love it," said Soriano. "If I'm healthy, play 130 games or 140 games I know my numbers will be there because I believe I have the talent."

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.

After Soriano's home gave the Cubs the lead, the Giants got it right back.

Brandon Belt tripled in Nady in the sixth and scored the tying run on Manuel Corpas' wild pitch. Then the Giants took advantage of Marmol's wildness to win it in the ninth.

"I got up in the right situation to put the team on top, and I got it done," said Pagan. "For us, we're trying to grind at-bats the best we can and make the at-bat as tough as possible."

The Cubs, who must now play another first-place team, the Washington Nationals, 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.

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.

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." ... The Cubs recalled RHP Miguel Socolovich from Triple-A Iowa. He was claimed off waivers from the Orioles on Aug. 23.