The Reds, who swept the Dodgers on Sunday night, sit eight games ahead of Washington in the race.
After managing just two hits against Miami on Friday, the Nationals collected 27 over the next two games to build some momentum as the team flies to New York for a four-game set with the Mets. As a team, the Nationals have scored five runs or more in 14 of 28 games since Aug. 9.
"I liked the way our lineup's swinging the bat," Nationals manager Davey Johnson said. "It was a big day for [Wilson] Ramos -- he's been swinging the bat good. Jayson Werth's been swinging the heck out of the bat every time he comes up. We just need to continue. We can't afford to have any lapses. We've got to win them all."
Ramos handed the Nats a 1-0 lead in the second with a leadoff homer off right-hander Jacob Turner (3-6) for his 11th home run of the season.
Having struck out two batters in the first, Strasburg (7-9) faced trouble in the second, as Miami took a 3-1 lead -- thanks, in part, to a pair of balks. Back-to-back singles up the middle by Justin Ruggiano and Logan Morrison and a walk by Placido Polanco loaded the bases.
Before throwing his first pitch to Adeiny Hechavarria, Strasburg was called for a balk, allowing a run to score. Hechavarria's slow roller down the first-base line drove in Morrison. Following Rob Brantly's walk, Turner's sacrifice bunt placed two runners into scoring position with two outs.
Strasburg balked another run in prior to the first pitch to Chris Coghlan. He entered the game with just one balk over 415 1/3 career innings. It came on May 26 against the Phillies.
The Nats' ace said he decided to make a change -- pitching from the wind-up rather than the stretch with runners on base. After he went through the normal sequence of signs, he forgot about the men in scoring position and moved.
"Pretty embarrassed with the balks," said Strasburg, who went just two innings in each of his previous two starts against the Marlins. "Seems like something new happens every time this year. [I'll] learn from it and try to do better with that next time."
Washington evened it at 3 in the third with two runs on three extra-base hits.
Ryan Zimmerman blasted his third dinger in the past two games to left field. The homer, his 20th of the season, was the 23rd long ball in his career against the Marlins, his high against any team.
Werth then doubled and moved to third on Adam LaRoche's flyout to center. Desmond doubled him home with a liner to right-center.
The Nationals regained the lead, 5-3, and chased Turner with no outs in the fifth.
Ramos' RBI single to left scored Desmond, who began the inning with a single and stole his 19th base of the season. Anthony Rendon's one-out triple past a diving Christian Yelich rolled all the way to the wall, driving in Ramos.
Desmond's two-out RBI triple to straightaway center in the sixth off right-hander Ryan Webb made it 6-3.
Ramos and Desmond combined to go 6-for-10 with four RBIs and three runs out of the fifth and sixth spots in the order. Vying to become the first Nationals player since Cristian Guzman in 2008 to hit for the cycle, Desmond grounded out to the pitcher in the ninth.
"I started letting go with my top hand, and was successful for it," said Desmond, who was 1-for-8 in the series entering Sunday. "Every day I do something different. See the ball, try to put the barrel on it, and [on Sunday] the experiment worked out."
The Marlins trimmed the deficit to two in the sixth on pinch-hitter Greg Dobbs' RBI single to right. But Strasburg escaped further damage in his final frame.
Strasburg had settled down to retire 11 in a row, before hitting Donovan Solano to start the sixth. He then struck Yelich out looking. Ruggiano followed with a single to put runners on first and second with one out. After Dobbs' hit, Ruggiano moved to second on a wild pitch to place a pair of men in scoring position. Hechavarria struck out swinging to end the threat.
Despite his struggles, Strasburg improved to 6-3 with a 3.86 ERA in his career against Miami. Five of his seven strikeouts on Sunday came via his curveball.
"We came out and scored some runs against a tough pitcher," Marlins manager Mike Redmond said. "We just weren't able to lock it down and secure that lead. We gave the momentum right back. Against a good pitcher, you've got to take advantage of things. We know we've got to pitch and play almost perfect to win."
Denard Span extended his career-high hitting streak to 19 games with a single to left in the fourth, tied for the third-longest in the Majors this season.
Relievers Drew Storen and Tyler Clippard threw a scoreless seventh and eighth, respectively. Closer Rafael Soriano pitched a perfect ninth for his 39th save, tied for fourth-most in the Majors.
"We've just got to take it one game at a time," Strasburg said. "Obviously, we're not guaranteed anything, so we just have to worry about ourselves, do what we can and play some good baseball down the stretch and see what happens."