Tanner Roark (2-2) earned the win after giving up four runs on six hits with six strikeouts over 5 2/3 innings.
Anthony Rizzo homered twice and Miguel Montero provided a solo shot for the Cubs, who won Thursday's series opener 2-1. Tsuyoshi Wada (0-1) gave up five runs on nine hits over 3 2/3 frames in the loss.
The Cubs pushed across three runs in the sixth to get within 5-4. Rizzo's second blast of the night scored Dexter Fowler, who reached with a one-out base hit, and Montero supplied a solo shot to center two batters later.
Anthony Rendon gave the Nationals some breathing room in the seventh by stroking a two-out single and hustling home on Ramos' double to right for a 6-4 game.
Dan Uggla added to Washington's lead with a pinch-hit RBI double in the eighth.
Drew Storen notched his NL-leading 18th save of the season despite giving up an RBI single to Chris Coghlan in the ninth.
Espinosa opened the scoring in the second by following Ramos' leadoff single and Desmond's double with a three-run shot to left.
Roark retired the first 10 batters he faced, but Rizzo got the Cubs on the board by crushing a fastball to right with one out in the fourth for a 3-1 game.
In the home half, Desmond opened the frame with a single, moved to third on Espinosa's ground-rule double and trotted home on Michael Taylor's sacrifice fly. Roark and Denard Span each singled to bring in another run for a 5-1 score.