WASHINGTON -- The Washington Nationals were six outs away from being swept by the New York Mets on Sunday night and likely enduring a round of stories about the demise of their season.
Two innings later, they were celebrating a crucial win.
Jayson Werth's RBI double capped a three-run eighth inning, and the Nationals rallied for a 6-5 win.
Werth, the National League's third-leading hitter, went 2-for-5 to raise his average to .323 and continued the torrid pace he's been on for two months.
"He's an unbelievable hitter at times and right now he's on fire," Bryce Harper said.
Washington (69-67) averted the sweep in the three-game series and gained a game on the Cincinnati Reds in the race for the second National League wild card.
"It's terrible," manager Davey Johnson said of the consequences had Washington been swept by a team that's without so many of its regulars.
"I can't sleep as it is. If we get swept, I'd be having nightmares on the bus to Philly. There's a lot of baseball left."
New York (62-73) collected 13 hits, but saw its three-game winning streak end.
With Washington trailing 5-3 in the eighth, Scott Hairston and pinch hitter Denard Span opened with singles of reliever Scott Rice. Harper bunted the runners over, and Mets manager Terry Collins called on reliever Gonzalez Germen (1-2) to face Anthony Rendon.
"Runners on first and second right there, you've got to get them over," said Harper, who made the decision to bunt on his own. "He actually hung me a curve ball I probably could have drove, but I was lucky enough to get one down, get those guys over."
Rendon grounded to short, scoring Hairston. Ryan Zimmerman (3-for-5) followed with a grounder up the middle. Shortstop Omar Quintanilla fielded the ball behind second and threw to first. Zimmerman was safe, and Span, who never stopped running, scored from second with the tying run.
Werth followed with a double to right-center, scoring Zimmerman from first with the lead run.
"He had the most unbelievable BP today," Johnson said of Werth. "He's been swinging the bat good. He's driven."
Washington had 16 hits, but stranded nine base runners in the first six innings.
"We finally got some hits with runners out there," Johnson said. "It took a while."
Erik Davis (1-0) pitched a scoreless eighth inning for his first major league win. Rafael Soriano pitched the ninth for his 36th save and the Mets had to settle for two-out-of-three.
"Anytime you can win a series, it's big. This time of the year, you've got to win as many as you can," manager Terry Collins said. "Certainly, this is one we're going to look back on and kick ourselves a little bit for letting it get away."
Trailing 5-2, the Nationals got an RBI single from Wilson Ramos off reliever Scott Atchison in the seventh after Atchison threw two wild pitches with a man on first.
Matt den Dekker hit his first big-league homer for the Mets, who led 3-0 after two innings.
Nationals starter Ross Ohlendorf lasted just five innings, allowing four runs on nine hits. He walked one and didn't strike out a batter.
New York's Jonathon Niese pitched around 10 hits and two walks, allowing just two runs. After he walked Harper with two outs in the sixth, Niese appeared in some discomfort and was taken out of the game. The Mets later announced he suffered a left calf cramp.
"A lot of things didn't go our way tonight," Niese said. "A lot of broken-bat hits, ground-ball hits that got through the hole. And that's kind of how it goes sometimes, a game can unravel in a hurry."
Eric Young and Daniel Murphy doubled in the first to give the Mets a 1-0 lead. Murphy later scored on Lucas Duda's single.
With one out in the second, den Dekker made it 3-0 when he sent an Ohlendorf fastball into the second deck in right-center.
Washington got one back in the second. Werth doubled, went to third on a groundout and scored on a two-out single by Tyler Moore.
The Nationals pulled to within 3-2 in the fourth.
Ian Desmond and Ramos singled. After Desmond went to third on a fly out, Hairston singled up the middle, scoring Desmond.
New York responded in the fifth as Murphy singled home Niese, who doubled.
Duda added another RBI single in the seventh.
NOTES: Two Washington regulars, Span and 1B Adam LaRoche, both left-handed hitters, were not in the lineup against left-hander Niese. Span wound up extending his hitting streak to 15 games. ... The Nationals recalled Davis and LHP Ian Krol from Triple-A Syracuse, and C Sandy Leon from Double-A Harrisburg. ... The Mets activated RHP Vic Black, selected the contract of LHP Tim Byrdak from Triple-A Las Vegas and recalled INF Zach Lutz from their top farm club. They also optioned LHP Robert Carson to Las Vegas. ... New York RHP Daisuke Matsuzaka (0-2, 8.68 ERA) opposes LHP Paul Maholm (9-10, 4.37) Monday at Atlanta. On Monday in Philadelphia, Washington RHP Stephen Strasburg (6-9, 2.96) faces LHP Cole Hamels (6-13, 3.58).