Miami, fourth in the NL East, is 26-39 against teams other the last-place Nationals.
Jon Berti stole two bases to increase his major-league leading total to 24.
Keibert Ruiz homered for Washington, which fell to 6-25 against the NL East and 29-50 overall. It lost its 50th game by the earliest date since the 2009 Nats were 22-50 after games of June 26.
Trevor Rogers (4-6) allowed one run and two hits in five innings. Rogers is 3-0 with a 2.25 ERA in three starts against the Nationals this season and 1-6 with a 6.58 ERA in 12 outings against other teams.
“I was getting ground balls right at guys,” Rogers said. “Even when they made solid contact, they were right at guys.”
Tanner Scott worked a perfect ninth for his eighth save in nine chances.
Washington starter Josiah Gray (6-5) retired Miami’s first six hitters before yielding Anderson’s solo shot to lead off the third. The Marlins pushed across two more runs with two outs in the inning when Joey Wendle hit an RBI single and scored on Garrett Cooper’s double.
Anderson’s homer was his first since May 14. He returned from the injured list Monday after missing 28 games with a lower back injury.
“After getting to see the other guys do it, I was starting to get a little jealous,” Anderson said of wearing the Marlins’ celebratory home run helmet. “That was a cool way to get us going today and I’m looking forward to wearing it a couple more times.”
Berti added a sacrifice fly in the fifth to make it 4-1, and Miami tacked on Anderson’s run-scoring single and Berti’s RBI fielder’s choice in the sixth against Gray, who allowed six runs and 10 hits in 5 2/3 innings.
“Nine batters he was ahead, he punched out six,” manager Dave Martinez said. “Seven batters he fell behind, five guys got on base. When he works ahead, he’s really good and we’ve seen that in the past. We have to get him to continue to work ahead and throw strikes.”
Miami selected the contract of OF Billy Hamilton from Triple-A Jacksonville and designated INF Erik Gonzalez for assignment. Gonzalez hit .189 with three RBI in 37 at-bats.
Washington recalled C Tres Barrera from Triple-A Rochester, optioned C Riley Adams to Rochester and designated LHP Sam Clay for assignment. Adams is hitting .192 with three homers and five RBI and is expected to play some first base in the minors. Clay had a 10.38 ERA in six games with Washington.
Marlins: Miami placed OF Jorge Soler (bilateral pelvis inflammation) on the 10-day IL and activated Wendle from the IL. Soler is hitting .217 with 13 homers and 34 RBI. … SS Miguel Rojas left in the ninth inning. “He kind of banged into Joey and had a little reaction,” manager Don Mattingly said. “It almost felt like a little stinger. It just seemed like we should get him out of there and make sure he’s OK for tomorrow.”
Nationals: OF Victor Robles left with a bruised left shin in the fifth. Martinez said X-rays were negative and that Robles is day to day. … Washington activated RHP Mason Thompson (biceps strain) from the 60-day IL. Thompson pitched a scoreless ninth, his first action in the majors since April 9. … RHP Aníbal Sánchez (cervical nerve impingement) will make his second rehabilitation start for Triple-A Rochester on Sunday. ... LHP Josh Rogers (shoulder impingement) allowed seven runs in 3 2/3 innings Thursday in a rehab start for Rochester.
Marlins: LHP Daniel Castano (0-1, 2.57 ERA), who is 0-2 with a 6.75 ERA in three lifetime appearances against Washington, gets the start Saturday as the series continues.
Nationals: RHP Jackson Tetreault (2-1, 4.24) has won back-to-back starts for Washington, allowing one earned run in 13 innings in that span.
Fantasy baseball pitcher rankings, lineup advice for Tuesday's MLB games
Everything you need to know to place your MLB bets and set your fantasy baseball lineups for Tuesday, August 9.
Fantasy baseball forecaster: Team hitting ratings
Stay ahead of the game and optimize your fantasy baseball hitters with our forecaster, which provides a rolling 10-day outlook of every team's hitting matchups as well as the potential for stolen bases.
Fantasy baseball forecaster: Pitcher projections for the next 10 days
Keep up to date on who is pitching -- and how well they're expected to do -- with our forecaster, which provides a rolling 10-day outlook of every team's probable starting pitchers with game score projections.
Paul DeJong's power appears to have returned
Sunday was a big day for Paul DeJong, who since his July 30 recall has looked much more like his 2017-19 self than the one who struggled in April and early May. Video by Tristan H. Cockcroft
How Juan Soto became a San Diego Padre -- inside the biggest deal in baseball history
It took weeks of maneuvering and hours of discussion -- and still hit an Eric Hosmer-related hiccup at the end. But by the afternoon of Aug. 2, baseball history was made.
Three things the San Diego Padres must do to beat the Los Angeles Dodgers
Even with their huge acquisitions, the Padres were swept by L.A. this weekend, dropping their head-to-head record to 2-8. What will it take to overcome their rivals?