Washington ended a three-game skid with Stephen Strasburg limiting the Diamondbacks to two runs over seven innings.
Strasburg (8-9) was held out of action for almost two weeks earlier this month due to forearm soreness and this was his second and final start after that layoff. He wound up with just two decisions over the last two months of the season, both victories.
Arizona had a 2-1 lead heading into the fifth, but Washington took the lead in that inning against Patrick Corbin (14-8).
Tyler Moore and Anthony Rendon opened the inning with doubles to account for a run that tied the game. Jeff Kobernus drew a walk and Werth unloaded on a 1-2 pitch that sailed over the wall in left for his 25th home run of the season.
Wilson Ramos added a three-run blast in the eighth for Washington.
Mathematician offers formula for finding the perfect Christmas tree
Twerking Brooklyn burglar 'dropped it like it was hot' prior to theft