Even though they're 30 games back in the standings as the long and tumultuous season gets closer to its end, the Chicago Cubs aren't giving up on any games.

Andrew McCutchen homered and reached base four times, and the Pittsburgh Pirates held off a late Chicago rally to snap a seven-game losing streak with a 7-6 win over the Cubs on Saturday.

The Cubs nearly rallied from an early five-run deficit, scoring two in the fifth, one in the eighth and two in the ninth.

In the final inning, Pirates closer Joel Hanrahan allowed Alfonso Soriano's RBI single and walked in a run, but got his 35th save when he struck out Dave Sappelt with the bases loaded to end it.

"We did a nice job battling," Cubs manager Dale Sveum said. "Everybody had great at-bats. It was nice to see everybody battle that whole game."

McCutchen launched Jason Berken's pitch off the rear fence behind the left-field bleachers leading off the third, his 28th round-tripper of the season. He also singled and walked twice, improving to .394 in 27 career games at Wrigley Field.

Berken (0-1) struggled in his Cubs debut, giving up eight hits in four innings, though just two of the six runs he allowed were earned.

"He was a victim of a couple of errors," Sveum said. "It could have been a decent little outing, five innings. Could have gotten into the fifth only giving up two, but the errors cost him pitches and the ability to go five or six today."

Berken, who was claimed off waivers on Sept. 7 after Baltimore designated him for assignment, became the 12th starting pitcher and the team-record 53rd player the Cubs have used this season.

"It was a great experience," Berken said. "Atmosphere was awesome. I wish I could have pitched a little bit better, but the atmosphere itself is something I'm going to remember for a long time."

The Cubs fell to 31 games under .500 and must win at least six of their last 17 games to avoid just the third 100-loss season in the franchise's 137-year history.

"They don't give up," Hanrahan said. "They've got a goal for them, too. I read something about them that they're not trying to get 100 losses. I've been in that situation, unfortunately, a couple years.

"The fans got into it there at the end. That's what they're out there trying to do. They've got a bunch of young guys and a good mix of young guys and old guys, so they're just leaving it all out there for the last two weeks."

Wandy Rodriguez (11-13) held Chicago to three runs — one earned — in helping the Pirates stop their free-fall in the NL playoff race. Pittsburgh had lost 17 of 22, yet was just three games behind St. Louis for the second NL wild-card slot entering the day.

Rodriguez is 3-0 with a 1.40 ERA over his last four starts after struggling initially upon being acquired midseason from Houston.

Anthony Rizzo had two hits and an RBI for Chicago, and Soriano drove in two runs, leaving him one RBI shy of his first 100 RBI season since 2005. The second RBI came during the ninth-inning rally that came up just short, but impressed Berken nonetheless.

"You can tell there is a lot of guys who care," Berken said. "It's fun to be around. I just have to be a little better next time, give us a chance to win."

Starlin Castro had two hits and reached base three times, but missed a chance to move into a tie for the NL lead in triples when he tripped over second base on a double up the right field line in the eighth.

"It's been a rough season for us, but we don't quit," Soriano said. "We try to have fun the last two or three weeks of the season so we can go home excited for next year."

NOTES: Cuban OF Jorge Soler made his first visit to a big league ballpark Saturday when he participated in pregame drills with the Cubs at Wrigley Field. The powerfully-built 20 year old put on an impressive display in batting practice, knocking two balls onto Waveland Avenue and three more that easily cleared the ivy in left. The Cubs won a hotly-contested bidding war for Soler, signing him to a nine-year, $30 million contract in June. ... OF Alex Presley (right foot) was unavailable Saturday after being hit by a pitch in the ninth inning Friday. ... Neil Walker started at second base for the Pirates for the first time since Aug. 26. He pinch hit in Friday's game, his first action after missing 15 games with a back injury.