A.J. Burnett worked seven innings in what was Pittsburgh's second straight victory. Washington has lost four of its last six.
It was a 1-1 contest when Starling Marte reached on a two-out single in the fifth off Ross Detwiler (1-3). Mercer followed with a homer to left on a 2-0 pitch.
Andrew McCutchen also homered for the Pirates in the third to overcome an early 1-0 deficit. It was the 11th of his career against Washington.
Burnett (3-2) gave up five hits and struck out nine. He is unbeaten in his last five starts. Jason Grilli allowed a one-out single in the ninth on the way to his 12th save.