Darin Ruf homered for his first major league hit, Carlos Ruiz and Domonic Brown also went deep and the Philadelphia Phillies beat the playoff-bound Washington Nationals 6-3 Tuesday night.

Drew Hallowell, Getty Images

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 1/2 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.

(Copyright 2012 by The Associated Press.  All Rights Reserved.)