PITTSBURGH (AP) Gregory Polanco and Andrew McCutchen homered and the Pittsburgh Pirates beat Chicago 7-5 on Wednesday night, ending the Cubs' season-best six-game winning streak.

Polanco led off the bottom of the first inning with a home run off Dan Haren, who was making his Cubs' debut, to open the scoring. He then hit an RBI single to break a 4-4 tie in a decisive two-run sixth inning.

McCutchen hit a solo homer in the third and added a sacrifice fly in the sixth to make it 6-4.

More from FoxSports

Francisco Cervelli and Aramis Ramirez each had two hits as the Pirates won for the 12th time in their last 15 home games at PNC Park.

Pittsburgh leads the NL wild-card race by a 3 1/2 games over the San Francisco Giants

The Cubs had tied it at 4 in the top of the sixth when rookie Kyle Schwarber hit a two-run home run, his fifth, and first baseman Anthony Rizzo added a solo blast, his 21st, to chase Locke.

Schwarber also doubled and Rizzo extended his hitting streak to seven games. The Cubs dropped to four games behind the Pirates in the wild card standings and host the Giants in a four-game series beginning Thursday night.

The Pirates added an insurance run in the eighth when Cervelli tripled and scored on Sean Rodriguez's single.

The Cubs got within two runs in the ninth on Addison Russell's run-scoring ground out, but Pirates Mark Melancon notched his 34th save in 35 tries by striking out Dexter Fowler with a runner on second for the final out.

Antonio Bastardo (3-1) retired the only batter he faced for the win, getting Chris Coghlan to ground out with the bases loaded to end the sixth.

Travis Wood (5-4) gave up three runs while retiring only one of four batters.

Both starters struggled, as Pirates left-hander Jeff Locke surrendered four runs in 5 2/3 innings and Haren allowed four runs --- three earned --- in five innings in his debut with his new team after being acquired from the Miami Marlins in a trade last Friday.

Home runs continued to plague Haren. He gave up two more after allowing 21 in his 21 starts with the Marlins. He is winless in his last four starts.

Locke has a 5.48 ERA in four starts since the All-Star break after posting a 1.59 mark in his final six outings of the first half. He had allowed only one home run in his previous 56 innings before Schwarber and Rizzo took him deep.

Haren's first inning with the Cubs was rough, as Polanco led off with his homer and Pedro Alvarez made it 2-0.

McCutchen's homer in the third made it 3-0.

The Cubs got a run in the fourth when Schwarber led off with a double and scored on Rizzo's sacrifice fly.

Ramirez got the run back for the Pirates in the bottom of the inning when he hit an RBI through a shifted left side of the infield.

TRAINER'S ROOM

Cubs: RHP Rafael Soriano was placed on the 15-day disabled list, retroactive to July 31, with right shoulder inflammation. LHP Clayton Richard was signed as a free agent, two days after being designated for assignment.

Pirates: 3B Josh Harrison (torn left thumb ligament) is expected to begin a rehab assignment with Triple-A Indianapolis Tuesday and SS Jordy Mercer (sprained left knee) is scheduled to join him Aug. 14.

UP NEXT

Cubs: RHP Jason Hammel (6-5, 3.13 ERA) faces San Francisco RHP Chris Heston (11-5, 3.24 ERA) on Thursday night.

Pirates: RHP Gerrit Cole (14-5, 2.29 ERA), who leads the major leagues in wins, will face Dodgers LHP Clayton Kershaw (9-6, 2.37 ERA), who has won his last four starts and has a streak of 37 consecutive scoreless innings, on Friday night.