WASHINGTON (AP) -- Jayson Werth helped get the Washington Nationals a little bit closer in the wild-card race.
Werth's two-out RBI double in the eighth inning capped a late rally and the Nationals avoided a series sweep with a 6-5 win over the New York Mets on Sunday night.
The Nationals trailed 5-2 entering the seventh, but scored once in that inning on Wilson Ramos' run-scoring single and added three in the eighth.
The victory moved Washington within 6½ games of Cincinnati for the final National League wild-card berth. The Reds lost at Colorado 7-4 on Sunday.
"We're stoked," said Bryce Harper, who reached base three times and contributed during the rally.
"I was fired up, unbelievably fired up when (Werth) hit that double. ... He's been in that situation so many times in his career. That was just an unbelievable moment."
Not so much for the Mets bullpen as reliever Gonzalez Germen (1-2) allowed one run after Scott Rice gave up two in the eighth.
"Anytime you can win a series, it's big," Mets manager Terry Collins said. "This time of the year, you've got to win as many as you can.
"Certainly, this is one we're going to look back on and kick ourselves a little bit for letting it get away. But yeah, winning a series is big."
Rice entered in the eighth with the Mets leading 5-3. New York's third pitcher, Rice allowed consecutive singles including Denard Span's pinch-hit single which extended the outfielder's hitting streak to 15 games.
After Harper sacrificed the runners to second and third, Scott Hairston scored on Anthony Rendon's groundout and Span came around on Ryan Zimmerman's infield single.
Werth's second double of the game found the right-center gap for one of Washington's 16 hits, scoring Zimmerman from first base.
"He had the most unbelievable BP today," Nationals manager Davey Johnson said of Werth. "He's been swinging the bat good. He's driven."
Because the Nationals drove in those late runs, they won't be lugging a losing skid with them to their next series.
Johnson: "I can't sleep as it is. ... I'd have nightmares riding on the bus to Philly. There is a lot of baseball left. We just have to keep chugging away one game at a time."
Recalled from Triple-A Syracuse before the game, reliever Erik Davis (1-0) pitched a scoreless eighth.
"It was exciting to get in there on my first day back," Davis said. "I was just happy to get out there and put up a zero. It was an awesome comeback by us."
Rafael Soriano, Washington's sixth pitcher, finished the Mets off in the ninth for his 36th save.
Daniel Murphy and Lucas Duda each drove in two runs, and Matt de Dekker smacked his first career home run for the Mets. New York last swept a series from Washington May 25-27, 2009.
Murphy's hot hitting stretch continued with an RBI double in the first inning and a two-out run-scoring single in the fifth against Ross Ohlendorf. The second baseman has 11 hits in his past 19 at-bats.
New York had 30 hits during the past two games.
Mets starter Jonathon Niese never had a 1-2-3 inning, but the Nationals managed only single runs in the second and fourth against him. He allowed two runs and 10 hits in 5 2-3 innings before leaving with a left leg cramp.
"It's that kind of year," Niese said of New York's string of injuries, including first baseman Ike Davis on Saturday.
"Today was tough, it was so humid. I was crushing Gatorades and water, and still cramping up."
Scott Atchison replaced Niese with two outs in the sixth and stranded two inherited runners.
Ramos' RBI single against Atchison in the seventh made it 5-3.
"We finally got some hits with runners out there," Johnson said. "It took a while."
Murphy followed Eric Young's leadoff double with a two-base hit for New York's first run and scored one out later on Duda's single.
Another RBI single from Duda, who started for Davis, made it 5-2 in the seventh.
New York went ahead 3-0 as de Dekker's first major league home run landed in the second deck of the right-center field stands.
Ohlendorf pitched five innings, allowing four runs and nine hits. He had a 2.82 ERA in four previous starts this season.
Notes: Zimmerman had three hits. ...The Mets, with their rotation depleted by injuries, have signed RHP Aaron Harang to a minor league contract and assigned him to Triple-A Las Vegas of the Pacific Coast League. Harang was 5-11 with a 5.76 ERA in 22 starts this year for the Seattle Mariners. Overall, he has pitched 12 years in the majors, going 110-115 with a 4.29 ERA. ... The Mets also called up three players, including RHP Vic Black, who was acquired on Aug. 27 from the Pirates in a deal that sent OF Marlon Byrd and C John Buck to Pittsburgh. ... Washington also recalled RHP Ian Krol from Triple-A Syracuse and catcher Sandy Leon from Double-A Harrisburg. ... RHP Daisuke Matsuzaka (0-2, 8.68 ERA) opposes Paul Maholm (9-10, 4.37) as New York opens a three-game series at Atlanta on Monday. ... Washington plays at Philadelphia on Monday as RHP Stephen Strasburg (6-9, 2.96 ERA) faces LHP Cole Hamels (6-13, 3.58 ERA).