Zimmerman lined a double to center off Ray to score Harper and give Washington a 2-1 lead. Zimmerman was 2-for-3, giving him a 10-game hitting streak, at least two hits for the sixth game in a row and a .427 average this season.
The winning pitcher was reliever Jacob Turner (1-0), who came on in the sixth and pitched four scoreless innings and gave up two hits. It was only his third appearance of the season and second out of the bullpen.
The loser was Ray (2-2), a former Washington minor leaguer who struck out 10 and yielded two runs and four hits. Chris Owings had two hits for Arizona, including a home run in the first.
Arizona became the first team in MLB history to strike out at least 10 batters in nine straight games. Ray got his 10th strikeout in the sixth as he fanned Jayson Werth but two batters later, Zimmerman had his big hit.
Ray, using a fastball in the mid-90s, got off to a fabulous start as he fanned the first five Washington hitters.
He was given a 1-0 cushion in the first on a homer by Owings, who went deep for the fifth time this season.
The Nationals finally broke through in the third as Michael A. Taylor led off with a triple that Arizona left fielder Yasmany Tomas appeared to lose in the lights. Two batters later Washington starter Gio Gonzalez drove in Taylor with a groundout to tie the game at 1.
Gonzalez fanned Brandon Drury for the third time to leave the bases loaded in the fifth. But he was lifted after allowing three hits, one run and seven walks with eight strikeouts in five innings.
NOTES: Washington RHP Max Scherzer (3-2, 2.94 ERA) will face Arizona RHP Braden Shipley on Thursday as Shipley makes his 2017 MLB debut. ... Several players and coaches with the Diamondbacks visited the Walter Reed National Military Medical Center in Bethesda, Md., before the game. The group included two of Wednesday's starters: 1B Paul Goldschmidt and SS Nick Ahmed. ... U.S. Senator John McCain of Arizona attended the game.