The Pirates had lost five of their previous six, but won the opener of this series with the help of a solid start from Gerrit Cole.
Cole (6-5) gave up two runs on five hits in six innings, after which Jeanmar Gomez struck out three during two perfect innings of relief. Mark Melancon retired the side in order in the ninth in a non-save situation.
The score was deadlocked at 2-2 heading into the fifth, but Pittsburgh put together three straight hits in the inning against Brandon McCarthy (2-7) to take the lead.
Starling Marte reached on a one-out single, Walker doubled Marte home with the tiebreaking run and Walker then scored on a single by Andrew McCutchen.
Jose Tabata added a two-run homer in the ninth for Pittsburgh insurance.
Ohio crash that killed two caught on camera [VIDEO]
Video of Victoria’s Secret models trying to 'twerk' hits Instagram