The Nationals won their seventh in a row in a desperate late-season bid to move into playoff contention. They began the night 5 1/2 games out of a wild card berth.
Washington scored single runs in each of the first three innings, two of them coming on home runs by Ramos in the second and Ryan Zimmerman in the third. Ramos then contributed a two-run single during a three-run fifth.
The Nationals' Denard Span went 1-for-5 and extended his hitting streak to 24 games.
Ross Ohlendorf (4-0) survived five innings to earn the win, limiting the Phillies to a run on five hits. He is unbeaten in six starts this year after having had only one winning season in his previous six major league campaigns.
Kyle Kendrick (10-13) gave up six runs on eight hits over 4 1/3 to take the loss.
Beautician charged with giving client fatal silicone butt injection
Ohio bar shooting arrested, charged with murder