Darnell McDonald hit a three-run homer and the Chicago Cubs held on Wednesday to win their last home game of the season 4-2 over the Pittsburgh Pirates.
The Pirates kept their one-game lead for the top NL wild-card spot over the Reds, who lost to the Mets. They fell three games behind the Cardinals in the NL Central with just three to play because St. Louis beat Washington.
Jake Arrieta (4-2) pitched six innings for the win, giving up a run, four hits and two walks with one strikeout.
Kevin Gregg gave up an RBI triple to Jose Tabata in the ninth but struck out two in a row to earn his 33rd save of the season.
The Cubs went 31-50 at Wrigley Field this season. They snapped a three-game losing streak and avoided being swept by the Pirates at home for the first time since May 5-7, 2000.
The Pirates, off to the playoffs for the first time since 1992, will finish their season at Cincinnati this weekend.
Francisco Liriano (16-8) -- trying to become the first Pirates pitcher to win more than 16 games in a season since lefty John Smiley went 20-8 in 1991 -- struck out eighth but took the loss. He gave up four runs, eight hits and a walk in five-plus innings.
McDonald's first home run as a Cub gave Chicago a 4-1 lead in the sixth inning and knocked Liriano out of the game. The homer also scored Donnie Murphy, who led off the inning with a single, and Junior Lake, who walked.
Justin Grimm struck out two in a perfect seventh inning for the Cubs and Pedro Strop worked around a Justin Morneau single in a scoreless eighth.
Tabata's triple in the ninth scored pinch-runner Felix Pie but Gregg fanned Marlon Byrd and Starling Marte to end the game.
Earlier, the Cubs took a 1-0 lead in the first inning after Darwin Barney doubled with one out and scored on Anthony Rizzo's single. The Pirates loaded the bases with two outs in the third and Arrieta walked Morneau to force home a run.
The Pirates went 12-7 against the Cubs this season, including a three-game sweep from May 21-23 ...The Cubs are 4-10 in their last 14 games.