CHICAGO (AP) -- The Pirates had a four-run lead in the first inning and were up two runs after five.
Both times the Cubs came back, with Starlin Castro providing much of the power.
In the end, the Pirates were finally able to shut down Chicago.
Jason Grilli closed with a perfect ninth for his second save in three chances.
''We just kept playing,'' Pirates manager Clint Hurdle said. ''It's not about what's not happening. It's about what we've got to do next. That's just the way we kept going. It was a fist fight off the mound for us most of the night. We executed extremely well in the first inning on offense and kept building innings.''
Cubs reliever Pedro Strop (0-1) walked two batters in the eighth and recorded only one out before being replaced by left-hander James Russell. Russell walked Alvarez to load the bases and Martin followed with a fly ball to right field that made it 7-6.
''Had we laid down after the first inning, giving up four runs, I would have been extremely disappointed,'' Cubs manager Rick Renteria said. ''But we didn't. We kept chipping away. I think that's what we're talking about. We have to fight. We have to keep battling every day and if they keep doing that we're going to get our situation where both sides of our game gets to where it needs to be.''
The Cubs tied the game in the seventh against Tony Watson (1-0) on Anthony Rizzo's hit up the middle scoring Emilio Bonifacio, who went 3 for 5 and is batting .515.
Castro hit a game-tying three-run homer in the third and a solo shot in the sixth against Pirates starter Charlie Morton for his first career multi-homer game.
''The two pitches that they scored four of their runs on were just terrible pitches,'' Morton said of Castro's homers. ''It could have turned out a lot better had I executed a little bit better even instead of giving up a home run. The guys picked me up.''
Jackson gave up six runs on nine hits in 4 2-3 innings. Jackson struggled with his command, walking four (one intentional) and hitting a batter. Morton didn't fare much better allowing five runs on eight hits in six innings.
Jackson's troubles began on the game's first pitch with a lead-off double by Starling Marte. It sparked a four-run inning. Nine Pirates batted in the first.
Alvarez doubled to score Marte and Andrew McCutchen for a 2-0 Pirates lead. Neil Walker added an RBI single and Travis Ishikawa's sacrifice fly made it 4-0.
Bonifacio's two-out single to center field in the second inning scored Ryan Sweeney from second base to cut the Pirates' lead to 4-1.
Jackson walked Marte and Travis Snider in the fourth to bring up McCutchen, who came through with an RBI single that made it 5-4. Ishikawa's triple in the fifth scored Martin, who doubled to start the inning, and extended Pittsburgh's lead to 6-4.
''He played more of a supporting role, you can see he's being pitched more difficult,'' Hurdle said of McCutchen. ''A lot of pitches, sequences, balls aren't there to hit but when they crossed the plate a couple times today he squared up and hit them really hard. He's a real good player.''
Renteria was ejected in the top of the ninth inning by home plate umpire Jeff Nelson for arguing balls and strikes. It was Renteria's first ejection.
Notes: Renteria said the Cubs are sticking with the five-man rotation as constructed meaning RHP Carlos Villanueva will stay in the rotation and not move back to the bullpen. . Cubs president of baseball operations Theo Epstein said he didn't have a problem with top prospect Javier Baez's recent ejection at Triple-A Iowa labeling it a ''great development experience'' for the 21-year-old shortstop. . Epstein said the Cubs are being cautious with Double-A Tennessee OF prospect Jorge Soler (sore right hamstring) by putting him on the seven-day disabled list. Soler aggravated his hamstring during the first minor league game of the season while running to second base on a double. . On the 40th anniversary of Hank Aaron hitting the 715th home run of his career to set an MLB record, Pirates manager Clint Hurdle fondly remembered the moment. ''I wasn't watching at the start and my dad tried to tune in the radio because we were in Florida,'' Hurdle said. ''We listened to a lot of the games on radio. As it turned out, it was a pretty magical moment.''