Asdrubal Cabrera also homered in the win, while Jayson Werth homered and stole two bases.
Gio Gonzalez (7-9) snapped a career-long nine-start winless drought after he allowed three runs on three hits over six-plus innings. The southpaw hadn't won since July 5.
Roberto Hernandez (8-10), who gave up just one unearned run against the Nationals in his previous two starts this season while with Philadelphia, surrendered five runs on five hits -- four home runs -- over 4 1/3 innings.
Matt Kemp homered among his two hits and drove in two for the Dodgers, who lead San Francisco by two games in the NL West.
Werth homered in the first to give Washington an early 1-0 lead. Kemp answered, however, with a two-run blast in the home half to give LA the lead.
The home run barrage continued as Cabrera lifted a solo shot over the wall in left-center to tie the game at 2-2 in the third, then Span cranked a homer out to right-center two batters later for a 3-2 lead. Span added a two-run shot, his fourth homer of the season, in the fifth that scored Cabrera.
Anthony Rendon's RBI double in the seventh gave Washington a four-run lead.
Kemp singled to begin the home seventh, just Los Angeles' second hit of the night, and Scott Van Slyke followed with a base hit that chased Gonzalez from the game. Drew Storen came in from the bullpen.
Juan Uribe knocked in Kemp with a single after Yasiel Puig grounded out to cut the deficit to 6-3.
Rafael Soriano gave up an RBI single to Uribe in the ninth and stranded a runners at the corners with a strikeout of Joc Pederson for his 31st save of the season.
Rendon also stole two bases in the win ... Washington leads Atlanta by seven games in the NL East ... Gonzalez doubled in the seventh and scored on Rendon's two-bagger ... Rendon has 35 doubles this season.
Celebrity Breakups and divorces of 2014 [PHOTOS]