Ramos hit a two-run homer in the seventh inning as the Nationals won with Zimmermann on the mound for a ninth straight start.

The right-hander allowed six hits and a walk in outpitching Jonathon Niese for 6 2/3 innings, helping Washington reduce its magic number for winning a second division title in three years to four.

"Be a lot better when the magic number is zero," Zimmermann said. "But we're in good shape, going down to Atlanta" for a three-game series in which they could clinch the East.

Drew Storen gave up two hits in the ninth but got Juan Lagares to fly out, finishing the eight-hitter for his fifth save.

Washington's ninth win in 10 games this season at Citi Field eliminated the Mets from the division race with 12 games to go. New York had won eight of 10 before the Nationals took three of four in this series.

"They have done an outstanding job of putting their team together," Mets manager Terry Collins said.

Zimmermann (11-5) hit two batters to up the total hit batters in the four-game series to nine, one shy of the record set last year in a series between Pittsburgh and Cincinnati, according to STATS. The right-hander nailed Eric Young Jr. and Lucas Duda but still won his sixth consecutive decision.

The Nationals had never won nine straight outings by one starter -- three of those wins came against the Mets. Washington improved to 13-3 against New York this season.

Ramos followed Bryce Harper's third sacrifice bunt of the year with a soaring drive beyond the 390-foot mark in right-center for his 10th homer.

The Nationals have outhomered the Mets 25-7 this season with three games left, Sept 23-25 in Washington.

New York had plenty of chances against the stingy Zimmermann, going 0 for 8 with runners in scoring position. The Mets' best opportunity came in the fourth, when they loaded the bases with one out. But Ruben Tejada lined out to the shortstop and Niese fouled out to third base on the ninth pitch of the at-bat.

"It was a question of making pitches when he needed to," Nationals manager Matt Williams said. "That's the sign of a veteran pitcher that knows what he is doing out there."

Niese (8-11) struck out the side after that grueling trip to the plate and fanned seven overall. Slowed by shoulder problems in the second half, the left-hander gave up two runs and six hits in seven innings.

"They do everything well and with every mistake a team makes, they make you pay," Niese said.

TRAINER'S ROOM

Nationals: Nationals 3B-OF Ryan Zimmerman (right hamstring) was scheduled to fly to the team's complex in Viera, Florida, after the game. He will work out Monday and play in an instructional league game the next day.

Mets: Mets reliever Vic Black will have his right shoulder examined by a doctor. Collins said Black has been complaining of having an achy feeling in the shoulder for a few days. The velocity on Black's fastball has been down a few mph. "We are concerned about it," Collins said. "This guy lives and dies with power stuff."

UP NEXT

Nationals: Stephen Strasburg (11-11) starts the series opener at Atlanta, which is in second place in the NL East. Strasburg's ERA against the Braves is 7.17, his worst against any division opponent.

Mets: Jacob deGrom (8-6) has not allowed an earned run in 22 innings. He faces a Miami lineup without slugger Giancarlo Stanton, who was hit in the face by a pitch this week and is likely out for the season.

CAN THEY DANCE?

The Nationals had rookie hazing day following the win, with a ballerina theme. Tiny powder blue or pink leotards and pink Tutus with fuschia socks were hanging in the new players' lockers. Squeezing into his outfit, outfielder Steven Souza asked, "Is this on backwards?"

NOT THIS YEAR

Niese entered 2014 with a 3-0 record and 2.47 ERA against the Nationals in eight starts. This year he is 0-3 with a 5.82 ERA in three starts.