Ramos finished 3-for-5 with two runs scored and Ryan Zimmerman went deep as the Nationals took the rubber match of a three-game series.
Stephen Strasburg (7-9) earned the decision, yielding four runs on four hits over six innings. He struck out seven.
Miami starter Jacob Turner (3-6) was touched for five runs on nine hits over four-plus innings.
Greg Dobbs and Adeiny Hechavarria each provided an RBI for the Marlins.