The Nationals have improved their playoff hopes with 11 wins in their last 16 games.
Rookie Tanner Roark (6-0) surrendered six hits and two runs over six innings in getting the win.
Zimmerman spotted him a 1-0 lead in the first with his 23rd home run of the season. It was his sixth home run in six games.
Daniel Murphy doubled in a run for the Mets in the bottom of the inning but LaRoche's drive to left-center in the second was reviewed and determined to be a home run -- his 20th of the year.
The Mets put together three singles in the fourth inning, with Anthony Recker driving in Lucas Duda, but Washington left fielder Bryce Harper threw out Mike Baxter at third. Roark then retired Ruben Tejada to end the threat and keep the score tied.
Ramos hit the second pitch of the fifth inning for his 13th home run and the Nationals weren't caught again.
The first three home runs came off Aaron Harang (5-12), who only gave up four hits and one walk while striking out 10 in six innings in his first start for the Mets.
LaRoche scored on a Rendon sacrifice fly in the seventh and Zimmerman doubled in one run and scored another in the eighth for a 6-2 lead. Rendon, hitting with one out in the ninth, got the fourth Nationals home run.