Josh Harrison opened the Pittsburgh 10th with a single off reliever Steve Ames (0-1) and took second on a sacrifice bunt from Clint Barnes. After an out, Starling Marte was intentionally walked.
Martin worked the count full and then drove the ball down the third-base line for a clean hit that got Harrison home.
It was the ninth walk-off win for Pittsburgh this season. Martin had four of those RBI.
It was the first major-league decision for Ames, who allowed four hits and the one run in 1 2/3 innings of work.
Jared Hughes (2-2), pitched a perfect 10th for Pittsburgh for the win.
Two innings later Walker, who finished 3-for-3 with two runs batted in, and Gaby Sanchez had sacrifice flies that tied the score.
Giancarlo Stanton and Placido Polanco had RBI hits in the first inning and Christian Yelich's first major-league home run -- a two-run shot -- in the fifth had put the Marlins ahead 4-0.
Yelich, batting leadoff, had three hits, two runs scored and two RBI.