Dunn ran his home run total for the year to 28, hitting a two-run blast in the first and a solo shot in the fourth. He also singled in a run in the seventh, giving him 71 RBI.
Craig Stammen (4-4) won his second straight start, holding the Diamondbacks to a run on six hits over 5 1/3 innings while throwing 99 pitches.
Ian Kennedy (6-9) suffered the loss, allowing four runs on eight hits in four innings.
Kennedy retired the first two men in the first inning before giving up a double to Ryan Zimmerman. Dunn swung at a 3-0 pitch and fouled it off before driving Kennedy's next delivery over the wall in right to put the Nationals in front for good.
Swim Week Miami Beach 2014 [PHOTOS]