Jayson Werth brought the Nationals from behind with a solo homer in the sixth and Washington produced the game-winner one inning later against Mike Dunn (3-4).
Denard Span drew a leadoff walk and went to second with one away when Dunn threw wildly to first on a pickoff attempt.
Werth then drew an intentional walk and Desmond hit Dunn's first offering to left to bring in Span.
Drew Storen (4-3) worked the seventh inning in relief to get the win. Storen, Tyler Clippard and Rafael Soriano combined to retire the last nine Miami batters in order. Soriano picked up his 35th save.
Jeff Mathis and Giancarlo Stanton both hit solo homers for the Marlins.
2014: The Year in Music [PHOTOS]