Wilson Ramos smacked a three-run homer and drove in four in the Washington Nationals' 9-6 win over the Philadelphia Phillies in the middle test of a three-game set.
Gio Gonzalez (9-6) fanned six and surrendered five runs -- though just one was earned -- on five hits and three walks over 5 2/3 innings for the Nationals, who moved 7 1/2 games behind the Cincinnati Reds for the NL's second wild card spot.
"That was an ugly game, one of the ugliest I've seen," Nationals manager Davey Johnson said. "That's not the way to win a pennant, I'll tell you that."
Rafael Soriano tossed a scoreless ninth to notch his 37th save of the year.
Ethan Martin (2-4) allowed five runs on four hits and five walks over 4 2/3 innings for Philadelphia, which rallied to take the first game of the set on Monday.
"Martin right from the get-go didn't establish his fastball," Phillies interim manager Ryne Sandberg said. "The bullpen came in and struggled."
Ramos' three-run shot into the seats in right-center staked the Nationals a 3-0 second-inning lead.
Cody Asche's two-out, two-run single in the fourth got the Phillies on the board, but Washington answered by plating a pair in the fifth on bases-loaded walks issued by Martin and reliever Justin De Fratus that gave the Nats a 5-2 edge.
A pair of two-out RBI singles by Jayson Werth and Ian Desmond in the sixth increased Washington's cushion to 7-2.
The Phillies got three runs back in the home sixth. Darin Ruf worked a one- out walk and later scored on Desmond's throwing error when John Mayberry bounced one to short two batters later. RBI singles by Michael Martinez and pinch-hitter Chase Utley later in the frame cut the gap to 7-5.
Pinch-hitter Corey Brown belted a solo homer into the second deck in right for Washington in the seventh before Asche answered with a solo blast of his own in the eighth to make it an 8-6 game.
Washington added an insurance run in the ninth as Denard Span, who reached with a single, later scored on a wild pitch by Philadelphia's B.J. Rosenberg.
Brown's homer was the second of his career ... Asche registered three hits and three RBI ... The Nationals were 3-for-13 with runners in scoring position, while Philadelphia finished 3-for-9 in those situations.