Ramos' blast came in the first inning, staking the Nats to a lead they wouldn't relinquish, and his bases-loaded walk in the fifth gave Washington a 5-2 advantage.
Corey Brown clouted his first major-league homer and Denard Span went 3-for-6 with two runs scored for the Nats, who rebounded from a 3-2 loss in Monday's three-game series opener.
Phils starter Ethan Martin (2-4) was lit up for five runs on four hits in a 4 2/3-inning effort.
Cody Asche went 3-for-4 with a solo homer and three RBI for Philadelphia.
Benedict Cumberbatch's dramatic reading of R. Kelly lyrics is just what you need
Beyonce flaunts bikini body, Blue Ivy in vacation pics