Cole Hamels (16-6) overcame five shaky innings to set a career high in wins and help the five-time defending NL East champion Phillies keep their faint postseason hopes alive. Hamels allowed three runs and seven hits, tying his shortest outing of the year.
Philadelphia entered 5½ games behind St. Louis for the NL's second wild-card spot. Milwaukee and the Los Angeles Dodgers also are ahead of the Phillies in the standings with eight games remaining.
The Nationals' magic number for winning the first division title in franchise history remained at five because Atlanta beat Miami 4-3. Their lead over the Braves dropped to four games with eight left.
Ross Detwiler (10-7) gave up five runs on five hits in five innings to lose for the first time since Aug. 22.
The Phillies assured that Washington won't pop bubbly on their field this week. The Nationals had to watch Philadelphia celebrate three times in the past five years, but they won't be able to return the favor here.
Ruf earned the nickname "Babe" by leading all minor leaguers with 38 homers this season, breaking Ryan Howard's single-season record at Double-A Reading.
He didn't take long to show his power stroke.
Ruf connected off Detwiler in the second inning, turning on an inside pitch and hitting a towering drive out to left-center. The rookie got the silent treatment in the dugout. Players held back smiles and ignored Ruf until the inning ended before congratulating him with high-fives. Fans in left field gave him a standing ovation when he jogged out to his position.
Control problems hurt Detwiler in the third. He walked John Mayberry Jr. and Chase Utley to start the inning. Howard followed with an RBI single on an 0-2 pitch. Ruiz then lined a three-run shot to left to make it 5-1.
Hamels, the 2008 World Series and NLCS MVP, won 15 games in '07. The three-time All-Star hadn't won more than 14 since until now.
This wasn't one of his better outings.
Five Philadelphia relievers tossed four innings of one-hit ball. Jonathan Papelbon finished for his 37th save in 41 tries.
Hamels issued a two-out walk to Danny Espinosa in the second. Espinosa stole second and scored on Kurt Suzuki's single to center for a 1-0 lead.
Bryce Harper hit an RBI single with two outs in the fifth to cut it to 5-2. Harper alertly advanced to second on the throw to the plate and scored Ryan Zimmerman's single that got the Nationals within two runs.
Brown gave the Phillies a 6-3 lead when he blasted Craig Stammen's first pitch way out to right leading off the bottom of the sixth.
NOTES: Ruf became the 24th different player to homer for the Phillies this season, setting a franchise record. The previous mark of 23 was set in 1996. ... The last Phillies player to homer for his first career hit was Mayberry on May 23, 2009 against the New York Yankees. ... Hamels is 13-5 vs. Washington. ... Detwiler is 7-2 vs. NL East teams. ... The Nationals fell to 13-10 in September. They're the only team in the majors with a winning record each month. ... Kyle Kendrick (10-11) faces John Lannan (3-0) on Wednesday night. Lannan is 2-12 vs. Philadelphia.