After Washington closed within a run, Ruiz cleared the wall in left off left-hander Jerry Blevins to push Philadelphia's advantage to 3-1.
Ramos homered to right with two outs in the ninth off Jonathan Papelbon, who earned his 32nd save in 34 opportunities.
Ben Revere, who began the day tied for the NL batting lead at .314 with Colorado's Justin Morneau, went 0-for-4 to drop his average to .311.
Chase Utley went 0-for-4, extending his slump to 3-for-29.
Nationals: Second baseman Asdrubal Cabrera was out of the starting lineup after injuring his rib in Sunday's 14-6 win over San Francisco. Manager Matt Williams said prior to the game that Cabrera is day-to-day. Cabrera pinch-hit in the ninth inning and singled.
Phillies: OF John Mayberry Jr. (wrist) played in his fifth rehab game with Triple-A Lehigh Valley on Monday night. Mayberry entered 4-for-14 with a homer and three RBIs in four games there.
Nationals: LHP Gio Gonzalez (6-9, 3.83) takes the mound for Washington at 7:05 Tuesday. He pitched seven shutout innings but got a no-decision in the Nationals' 1-0 win over Arizona Thursday. Gonzalez has received two runs of support over 33 1/3 innings in his last six starts.
Phillies: LHP Cole Hamels (7-6, 2.53) got rare run support in his last outing when he snapped string of seven straight starts with at least seven innings in a 4-3 win over Seattle Wednesday. Hamels is 15-7 with a 2.54 ERA in 30 careers starts against Washington.
The Nationals challenged second-base umpire Gary Cederstrom's safe call on Brown's would-be double leading off the seventh inning, and the call was overturned by replay review after an estimated delay of 2:02.
MOVING UP SAVES LIST
Papelbon earned his 318th career save, tying Rick Aguilera for 18th all-time in saves.