With the victory, Washington's National League East lead grew to seven games as four Phillies pitchers no-hit the Braves earlier in the day.
The Nationals were able to get to Hernandez in the first inning, when Jayson Werth hit a 2-2 pitch over the center-field wall for his 16th home run.
"Tonight, we were able to get to Hernandez a little bit. He got the ball up in the zone," manager Matt Williams said. "The ball was really carrying at the start of the game. It felt like a day game, warm weather, ball carries generally better in the daytime. We took advantage of that."
But Los Angeles scored two runs of their own against left-hander Gio Gonzalez as Matt Kemp hit a mammoth two-run home run over the right-field wall to give L.A. a one-run lead after one inning.
Gonzalez settled down after that, however. At one point he retired 13 straight hitters on the way to snapping a personal five-game losing streak.
"I kept attacking the strike zone," Gonzalez said. "[Catcher Wilson Ramos] was calling a great game, mixing it up and helping me feel confident. He was also trying to prevent me from keeping the ball up. The first couple of innings, it was a nice, hot day. It cooled off afterward."
By the third inning, the Nationals gave Gonzalez the lead. Both Asdrubal Cabrera and Denard Span hit solo home runs for a one-run Washington lead. Two innings later, Span went yard again. This time it was a two-run homer.
When the camera panned on Span, he seemed shocked that he was capable of hitting home runs. But eating at a special restaurant on Sunset Blvd did wonders for him.
"I must have felt something. Last night, I did eat at Roscoe's Chicken and Waffles. That might have helped a little bit tonight," Span said. "It's been a while since I [hit two home runs]. It was a good day. It ended up being two big hits for a win."
Span has hit three home runs in his last four games, and it was the second time in his career he has hit two homers in a game. The last time he did it was Sept. 13, 2008, when he was in his first big league season, while with the Twins.
"I really can't explain it other than the home runs come in bulk," Span said. "I'm just hitting the ball pretty good. I'm going out there and not trying to hit home runs. I hit the ball hard somewhere, and that's really it."
In the last four games, the Nationals have hit 14 home runs.
"It's not something that we live by. We manufacture better than we hit homers, but we'll take them. You can't give them back. We'll try to win games however we can," Williams said.
The Nationals scored their final run off reliever Brandon League in the seventh inning. After hitting a leadoff double, Gonzalez scored on a double by Anthony Rendon to make it a four-run game.
Gonzalez left the game in the seventh inning after allowing consecutive singles to Kemp and Scott Van Slyke. Drew Storen entered, and two batters later, Juan Uribe singled to center field to make it a three-run game. After A.J. Ellis flied out, left-hander Matt Thornton struck out Justin Turner to end the threat.
"We finally get Gio out of there and put some runs on the board, and we just come up a little [short]. How far to read into it? We lost the game, and we didn't do enough to win it," Dodgers manager Don Mattingly said.
Tyler Clippard pitched a scoreless eighth, while the Dodgers got a run off Nationals closer Rafael Soriano in the ninth before pinch-hitter Joc Pederson, representing the winning run in his first big league at-bat, struck out to end the game.
Since blowing the game against the Marlins on July 28, Soriano has a 7.24 ERA with six saves. Williams continues to say that Soriano is his closer.
"It's the last out and we got it and that's what matters," Williams said. "The Dodgers put some good at-bats together. Sori got two quick outs, and they hit a couple of balls back through the middle, but he got the last one. That's all that matters."