Werth's shot in the fourth inning put the Nationals up 4-0 and Jonny Gomes added an RBI as Washington took its fifth win in seven contests in the opener of a four-game series against the Diamondbacks.
Detwiler (2-3) went 6 2/3 innings to pick up the victory, allowing one run on six hits and a walk. He struck out three.
Henry Rodriguez and Ryan Mathheus combined for 1 1/3 scoreless frames and Drew Storen worked a 1-2-3 ninth to record his 34th save.
Arizona's Joe Saunders (8-11) was tagged for four runs on six hits in a six-inning start as the National League West-leading D-backs saw their lead over San Francisco shrink to one game.
Henry Blanco delivered a solo shot for Arizona.
Putin thinks Obama would save him if he were drowning
Justin Bieber crashes Drake Bell's album release party