Updated

The Pittsburgh Pirates had just lost consecutive home games for the first time in over two months.

Yet there was a sense of optimism in the Pirates' clubhouse following a 5-1 loss to the Chicago Cubs on Tuesday night, even though they fell 2 1-2 games behind Cincinnati in the NL Central.

The Pirates were buoyed by the postgame announcement that they had acquired veteran left-hander Wandy Rodriguez from the Houston Astros in a trade for three minor leaguers.

It was the first time the Pirates had acquired a pitcher for a potential pennant push since trading with the Cubs for Danny Jackson in 1992. The Pirates won the NL East that season but haven't been back to the postseason or even had a winning record since.

The Pirates will get up to $17.7 million in the deal to offset what could amount to over $30 million in salary for Rodriguez. They are sending Triple-A All-Star Rudy Owens and Colton Cain, both left-handers, and outfielder Robbie Grossman to Houston.

"We talked since Day One of the trading season about wanting to improve our club either via pitching or via hitting," Pirates general manager Neal Huntington said. "The pitching market turned out to be more flexible than the hitting market and we decided this was the right move for us."

The only player on the Astros roster remaining from their 2005 trip to the World Series, Rodriguez has been a steady presence on a rebuilding ballclub that has the worst record in the majors this year and lost 106 games last season.

Signed by the Astros in 1999, he is 80-84 with a 4.04 ERA in eight seasons. Rodriguez is 7-9 with a 3.79 ERA this year.

Pittsburgh manager Clint Hurdle believes Rodriguez will be helped by a change of scenery.

"I'm sure a change of clubhouses for him, a change of the dynamic of being in a situation (a pennant race) he hasn't been in for three or four years should be helpful," Hurdle said. "I've prepared for him for many years as a manager and as a coach. He has also been a tough pitcher to hit, a tough pitcher to beat. I'm very happy that we're adding him to our rotation."

James McDonald (10-4), who has been a mainstay of the Pirates' rotation this season, had his career-best five-game winning streak snapped

McDonald was touched for five runs and five hits in six innings while walking three and striking out six.

Starlin Castro and Alfonso Soriano both homered. David DeJesus hit a tiebreaking two-run double for Chicago, which had totaled just three runs in its previous four games.

DeJesus doubled to left in the fifth inning to put the Cubs ahead 3-1, the hit coming after Maholm drew a two-out walk to load the bases. Geovany Soto and Luis Valbuena, who had both also walked, scored on the double.

"I was actually pretty pleased with this outing," McDonald said. "The ball came out of my hand really well. I felt like I had good command of my pitches, especially my curveball. They hit some good pitches and that's going to happen sometimes."

Cubs left-hander Paul Maholm pitched eight strong innings Tuesday night to win his fifth straight start. He gave up one run and four hits in handing the Pittsburgh its first consecutive home losses since May 22-23. He struck out seven and walked one.

Maholm has allowed just four earned runs in 38 1-3 innings during his winning streak for a 0.94 ERA in that span. The left-hander spent his first seven seasons with the Pirates before signing with the Cubs as a free agent last winter.

"I've made more than a few starts here and I enjoy pitching here," Maholm said of PNC Park. "Obviously, it's a pitcher-friendly park and if you make your pitches, it's going to work out well for a ground ball guy. I thought I did well and executed my pitches and it always help to get good defense and some runs to work with."

Castro hit his ninth homer with one out in the first inning to open the scoring.

Pittsburgh's Garrett Jones answered with a solo shot in the fourth, his 14th of the season and first off a lefty since last Aug. 16 when he hit a game-ending homer off St. Louis' Arthur Rhodes.

Soriano's two-run homer in the fifth, his 19th, pushed the Cubs' lead to 5-1.

Chicago closer Carlos Marmol pitched a scoreless ninth in a non-save situation, working around a leadoff double by Neil Walker and a walk to Andrew McCutchen.

The Pirates had provided McDonald with 44 runs of support in six starts during his winning streak.

NOTES: Dempster (5-4, 2.11 ERA) is scheduled to start Wednesday against Pittsburgh RHP Kevin Correia in the finale of the three-game series. Dempster leads the major leagues in ERA. ... Matt Garza (strained right triceps) will not make his scheduled start Friday against the Cardinals and will be reevaluated that day. He was removed from his previous start last Saturday at St. Louis after pitching three scoreless innings. The Cubs are optimistic Garza will not need to be placed on the DL. ... Correia will be looking to extend his five-game winning streak, the best of his career. Correia is 6-1 in his last 10 starts since losing five straight starts from April 29-May 20.