PITTSBURGH (AP) Don Mattingly looked at the group of media assembled in front of him and smiled.
''You're going to need a whole new notebook to write down everything that happened in this game,'' the Miami Marlins manager said Friday night.
Robert Andino hit a tiebreaking single in the top of the ninth inning, then the Marlins got Andrew McCutchen to ground into a game-ending double play with the bases loaded to hold off Pittsburgh 6-5 in a matchup of NL wild-card contenders.
''Anytime you get a win now, it's big and it gives you momentum, at least until the next day,'' Mattingly said. ''It's important for our guys to be in this situation, where they've playing important games at this time of year. We have a lot of guys who haven't been through it before.''
JT Realmuto, who homered in going 3 for 3, drew a leadoff walk in the Miami ninth from Neftali Feliz (4-1). Realmuto moved up on a sacrifice bunt and scored when Andino lined his single into left field.
''Feliz throws really hard and you know it's going to be a tough at-bat,'' Andino said. ''I just wanted to put the best swing on it that I could and it worked out.''
Christian Yelich and Miguel Rojas also each had three hits and a homer as the Marlins won for just the third time in nine games. The Pirates' loss was their second in eight games.
Fernando Rodney wound up with his 22nd save in 24 opportunities. He issued an intentional walk to Starling Marte - who already had three hits - to load the bases for McCutchen.
The former NL MVP stayed stuck in a season-long slump when he bounced into a double play.
''It's a tough decision,'' Mattingly said. ''At least, we have a (potential) force play if we load the bases, so if we get a ground ball then we have a chance to get (a double play).''
Nick Wittgren (4-2) pitched a scoreless eighth.
The Marlins scored twice in the eighth off Felipe Rivero to make it 5-all. Rojas hit a solo homer, his first of the season, and Dee Gordon reached on a double error by third baseman Jung Ho Kang with two outs and came home on Yelich's single.
The Pirates went ahead 5-3 with a three-run seventh. The first run scored on pitcher Dustin McGowan's throwing error, then Josh Harrison hit a sacrifice fly and Marte doubled in a run.
David Freese put the Pirates ahead 2-1 hit a two-run homer, his 12th, in the fourth off Tom Koehler.
Pirates starter Gerrit Cole gave up three runs and 12 hits in 6 2/3 innings.
''It was two teams out there battling, and we didn't do enough things well enough to win,'' Pirates manager Clint Hurdle said.
Marlins: RHP A.J. Ramos (fractured right middle finger) pitched a simulated game and the closer could be activated from the disabled list Sunday after being out since Aug. 9.
1B Xavier Scruggs was in the Marlins' lineup and went 1 for 3 with a walk after his contract was selected from Triple-A New Orleans. LHP Chris Narveson was designated for assignment.
Scruggs, who hit .408 with five home runs in his last 10 minor leagues games, will get a chance to help fill the void that has existed since 1B Justin Bour (sprained right ankle) went on DL on July 3. The Marlins have been platooning INF/OF Derek Dietrich and INF Chris Johnson at first.
Marlins: RHP David Phelps (6-6, 2.48 ERA) starts Saturday night and is 1-1 with a 1.84 ERA in three outings since being moved into the rotation from the bullpen.
Pirates: RHP Chad Kuhl (3-0, 3.73) makes his seventh career start and Pittsburgh is 6-0 in games the rookie has pitched.