WASHINGTON -- It's not every day a manager intentionally puts the potential winning run on base in the ninth inning against a red-hot offense.
"Just the better matchup," Sandberg said. "Sometimes Harper seems to make things happen, as he did earlier with the broken-bat base hit."
Ramos hit a smash toward short, but Jimmy Rollins threw him out to end the game and give Papelbon his 27th save.
"(Rollins) made a very nice read on that, retreating back," Sandberg said. "That was an in-between hop that he made a little bit longer. A heck of a play right there, it really was."
The Nationals, who had scored three in the seventh to pull within 5-4, fell 5 games behind the Reds (winners in Milwaukee) for the second NL wild card.
"We're still fine, we've just got to win the games," manager Davey Johnson said. "Just got to keep winning."
Cole Hamels (8-13) won his fourth straight decision, allowing four runs, three earned, on eight hits in six-plus innings.
Washington's Denard Span went 3 for 5 to extend his hitting streak to 25 games and stole a career-high three bases.
Gio Gonzalez (10-7), coming off a one-hitter against the Mets, allowed four runs on nine hits in six innings.
"It's a tough loss right there, especially when these guys battled all the way to the end," Gonzalez said.
Left-hander Cesar Jimenez came in to pitch to Harper and Harper blooped a single to center scoring Zimmerman. When center fielder Cesar Hernandez overran the ball, Harper went to second and Werth scored from first.
B.J. Rosenberg fanned Ramos on a called third strike.
Philadelphia took the lead in the fifth. With one out, Mayberry hit an 0-1 offering from Gonzalez into the visitors' bullpen to tie the score.
The Phillies weren't done as Hamels and Hernandez followed with singles. Rollins flied out, but Chase Utley walked to load the bases. After pitching coach Steve McCatty visited Gonzalez, Ruiz hit the left-hander's first pitch over Werth's head in right for a bases-clearing double.
"He's using the whole field. I mean the double down left field line his first at-bat. The double down the right-field line," Sandberg said. "He's the right guy up with men on base for us, for a month."
Since Aug. 8, Ruiz is batting .583 (14 for 24) with runners in scoring position, with six doubles and 19 RBIs.
"I'm not trying to do too much," Ruiz said. "Just put the ball in play and see what happens."
Utley added what turned out to be a crucial RBI-single in the seventh to make it 5-1.
Washington took the lead in the first. Span singled, stole second, went to third on a wild pitch and scored on Werth's sacrifice fly.
The Reds' win officially eliminated Philadelphia from playoff contention. ... Johnson said RHP Stephen Strasburg (forearm tightness) will play catch Sunday. If that goes well, the next step is a bullpen session Monday in anticipation of a start on Thursday, one day after what would have been his next regular turn. RHP Ross Ohlendorf, who started Friday in place of Strasburg, will start on Wednesday. ... LHP Ross Detwiler (back strain), on the disabled list since July 4, threw a bullpen session Saturday. Johnson said he'll throw one more before facing hitters in a simulated game or batting practice session. ... Phillies RHP Luis Garcia (bruised foot) was unavailable after being hit by a Wilson Ramos grounder Friday. ... Washington's Jordan Zimmerman (17-8, 3.36) opposes Tyler Cloyd (2-4, 4.56) in Sunday's series finale.