The New York Mets did something special Friday night, beating the Milwaukee Brewers at Miller Park.

"They play great here, we know they play great here," Mets manager Terry Collins said. "They're in the hunt. They don't make many mistakes, so when they do, you've got to capitalize on it, and we did tonight."

Lucas Duda homered and doubled, Jonathon Niese pitched six strong innings and New York snapped a six-game losing streak, beating the surging Brewers 7-3.

The loss dropped Milwaukee back to .500 at 72-72 — four games behind the St. Louis Cardinals for the second National League wild-card spot.

Niese (11-9), who had lost three straight starts, settled down after giving up two second-inning runs, allowing six hits, three walks and the two runs. He also had two hits and scored a run, helping the Mets to their biggest offensive output since a 9-5 extra-inning victory over Philadelphia on Aug. 28.

Daniel Murphy also homered for New York.

"That's what we saw last year out of Lucas, and we know it's in him," Collins said about Duda. "He changes the look of the batting order because everybody knows he can hit a home run. When he's swinging like he did tonight, he's dangerous."

Mike Fiers (9-8) gave up six hits and four runs in five innings for Milwaukee, which had won 18 of 23 coming in. Fiers struggled from the start, and the Mets scored twice in both the first and second innings, equaling their offensive output in three losses in a sweep against Washington.

In the first, Murphy walked with one out, went to third on David Wright's double and scored on Ike Davis' groundout. Wright scored on Duda's ground-rule double.

The Mets made it 4-0 in the second when Niese singled with one out and, two batters later, Murphy hit a ball into the second deck in right field for his sixth home run of the season.

"After the second inning, we haven't scored that many runs in three games," Collins said. "But we kept it up, and Jon made it stand up. The six-man rotation — that extra day has helped stay pretty strong."

Milwaukee answered with two in the second, and it would have been more but for two runners getting thrown out at home. Jonathan Lucroy and Carlos Gomez led off with singles, and Travis Ishikawa doubled in Lucroy. Jean Segura grounded to Niese, who caught Gomez off third base, and Wright eventually tagged him out in a rundown. Fiers then singled in Ishikawa for his second RBI of the season. Norichika Aoki bounced to third, and Segura was tagged out at home. Rickie Weeks struck out to end the threat.

"They battled me really good today," Niese said. "They've got a great lineup. But I do feel good. Obviously I've been getting a lot of rest now between starts."

Shoddy defense cost Milwaukee in the sixth.

Duda homered to right center off reliever Manny Parra to lead off the inning — his second since being recalled from Triple-A Buffalo on Aug. 26.

Then, with one out, Andres Torres reached on an error by shortstop Jean Segura, who threw high to first on the slow roller. Torres scored on Josh Thole's double. Niese followed with an infield single that caromed off third baseman Aramis Ramirez's chest — barely keeping alive his errorless streak of 42 games. Ruben Tejada followed with what should have been an easy double-play grounder to Ramirez, but Rickie Weeks' relay throw to first bounced in the dirt and got away from Ishikawa, scoring Thole.

The Brewers threatened in the eighth with leadoff singles by Ryan Braun and Ramirez before a spectacular Mets double play, as Lucroy grounded sharply up the middle to a diving Tejada, who from his stomach flipped the ball to second, where Murphy pivoted and threw quickly to first.

"You never know," Lucroy said. "What did we have the other day against the Braves? We had an eight-run inning. We can hang some numbers on you quick. And that last double play was a killer for us. If that ball would have snuck through . guys are on first and second or first and third with nobody out, and a bloop, walk and a homer and you're right back in it."

Milwaukee added a run in the ninth on Nyjer Morgan's RBI triple.

The Brewers had won nine straight at home, tying a Miller Park record, and were one shy of equaling the franchise mark. The streak included a sweep of the Atlanta Braves earlier in the week that put them over .500 for the first time since they were 4-3 on April 12. Milwaukee was 12 games under .500 as recently as Aug. 19 before its recent streak made it a wild-card contender.

The Mets — 19-38 since the All-Star Break entering play — had lost eight of nine and came in 13 games under .500 for the first time since the end of the 2009 season.

Notes: Mets 3B David Wright extended his hitting streak to eight games with his first-inning double. ... Brewers 1B Corey Hart missed his fourth straight game with plantar fasciitis in his left foot. ... New York Mets RHP Jenrry Mejia starts on Saturday — exactly two years since his last major league start. Mejia started three games for New York in 2010 and did not pitch in the majors in 2011 after Tommy John surgery. He has one relief appearance since being recalled Sept. 4.