CHICAGO -- Cody Ransom slugged a three-run, go-ahead home run in the seventh inning as the Chicago Cubs avoided a series sweep with a 4-1 victory over the Pittsburgh Pirates on Sunday afternoon.
Ransom's homer to left -- his sixth of the season -- came off Pirates reliever Justin Wilson and brought home Julio Borbon and Darwin Barney.
Wilson (5-1) had one of his poorest outings of the season after being scored on just once in his previous nine games.
The victory snapped Chicago's two-game losing streak. Pittsburgh had won two straight over the Cubs at Wrigley Field this weekend before Sunday's loss.
Pirates starter Jeff Locke nursed a 1-0 lead and took a no-hitter through 5 2/3 innings. But he departed after walking a pair, giving up a run-scoring sacrifice fly and his lone hit of the game.
Locke allowed just one earned run while walking seven and striking out six. Wilson lasted just 1 1/3 innings and allowed three earned runs on four hits.
Cubs right-hander Edwin Jackson (2-8) picked up his first victory since an 8-2 decision at Washington on May 11. He worked seven full innings and allowed just one earned run on four hits, while striking out eight and walking one.
Right-handed reliever Kevin Gregg worked the ninth for his seventh save.
Pittsburgh broke a scoreless tie with a single run in the fourth. Andrew McCutchen led off with a double to left and scored his 400th career run on Garrett Jones' RBI single to center.
The Cubs tied the game in the sixth without a hit and Locke the lost his no-hitter by giving up a two-out single.
Ransom led off the inning with a walk and advanced to third on Anthony Rizzo's ground out to second. Scott Hairston drove Ransom home with a sacrifice fly to deep center.
Dioner Navarro ended the no-hitter with a single to left. Locke departed in favor of Wilson, who got out of the inning by striking out Starlin Castro.
The Pirates threatened in the second with Locke at second and Clint Barnes at third with two out. But Travis Snider popped to left to close the inning.
Locke walked back-to-back Cubs batters with two out in the third, leaving Ransom in scoring position for Alfonso Soriano. But Locke got out of the inning with an alert throw to second baseman Neil Walker to tag Ransom.
The Cubs open a four-game home series with the Reds at 7:05 p.m. Monday. Right hander Scott Feldman (5-4, 2.84 ERA) goes against Cincinnati righty Homer Bailey (3-4, 3.84 ERA).
Right-hander Gerrit Cole makes his Major League debut on Tuesday as the Pirates open a three-game home series against the Giants. San Francisco counters with right hander Tim Linceum (4-5, 4.75 ERA).
NOTES: Cole, the No. 1 overall selection in the 2011 draft, went 5-3 with a 2.91 ERA in 12 starts at Triple-A Indianapolis this season. In his last start against Durham, he tossed seven scoreless innings in a 1-0 triumph. ... The Pirates return to Pittsburgh on Tuesday for a six-game home stand, including three apiece against the Giants and Dodgers. They're 21-11 at PNC Park. ... Wilson entered Sunday's game tops among National League relievers in innings pitched (35.0) and tied for fifth in strikeouts (34). ... Castro remained in the No. 7 spot in the order. The slumping shortstop was batting .247 entering Sunday's game. He remains the Cubs' Iron Man with 255 consecutive games, the longest active streak in the National League. ... Chicago entered the series finale with a .164 team average (42-for-256) with 14 runs scored in eight games against the Pirates. ... The Cubs were hitting .262 in 31 home games but just .227 in 28 road contests. ... Soriano needs two home runs to tie Albert Belle for 63rd in Major League history with 381 home runs. He has 26 against the Pirates.