With the Marlins trailing 2-0, winning pitcher Carlos Zambrano (5-7) led off the third with a single off Edwin Jackson (5-5). Jose Reyes followed with another hit and Emilio Bonifacio moved them up with a sacrifice bunt.
Carlos Lee then tied the score by lining a pitch into center field for a two-run single, and one out later Ramirez hammered a two-run shot over the left field wall.
Zambrano went six innings, giving up three runs on eight hits while walking four and fanning two for the Marlins, who gained a split in their four-game series with the Nationals.
Jackson ended up yielding four runs on six hits through five frames.
Notable deaths of 2014 [PHOTOS]
Michael Sam cut from the Dallas Cowboys