NEW YORK — After charging into the wild-card race from way behind, Michael Conforto and the New York Mets weren't about to get eliminated without making at least one more big comeback.

Conforto homered twice and the Mets rallied just in time to keep their faint playoff hopes alive Tuesday night, beating the Miami Marlins 5-4 in 11 innings. New York trailed by four runs in the seventh but overcame its largest deficit to win this season.

"We're going to keep on fighting," manager Mickey Callaway said. "As long as there's a chance, we're going to keep on going. We've seen, in a five-game stretch, anything is possible."

Three outs from post-season elimination, the Mets tied it 4-all in the ninth when Conforto connected off José Ureña for his second two-run homer of the game. Brandon Nimmo won it by working a bases-loaded walk in the 11th against rookie Jeff Brigham.

Following wins by Washington and Milwaukee earlier in the day, the Mets needed a victory to stay in the pennant race. They are tied with the plummeting Chicago Cubs, five games behind the streaking Brewers for the second NL wild card with five to play.

"I think we're frustrated that we're not in a better position," Conforto said. "I think we had a lot of opportunities throughout the year, but at the same time, being here from where we were last year at this point, we've shown some improvement."

Paul Sewald (1-1), the seventh Mets pitcher, struck out two in a perfect inning for his first major league win in 119 appearances. He began his career with 14 straight losses, an NL record.

New York was 40-51 and all but forgotten after dropping its first game following the All-Star break. Yet the Mets made a surprising push and closed within two games of a playoff spot on Sept. 12. They are 82-75, securing their third winning season in five years following a six-year drought.

But now they have no margin for error at all — and need Milwaukee to lose five straight for a chance to force a wild-card tiebreaker.

"It's not where we want to be at the end of the season. The goal is to play in October, and we'll see if things shake out the right way for us," Conforto said. "We'll have this to look back on and understand you've got to play every day, nine innings, extra innings, whatever it is. We've got to play to win all the way through."

Conforto drew a leadoff walk from Adam Conley (2-10) in the 11th, and Brigham hit Amed Rosario with a 97 mph fastball. A wild pitch advanced both runners before Todd Frazier was intentionally walked.

One out later, Nimmo walked on a 3-1 pitch to force in the winning run. He jogged to first base where Pete Alonso pulled off his teammate's jersey, leaving Nimmo doused and soaked in a blue undershirt.

Marlins prospect Isan Díaz homered early and hit an RBI single off Noah Syndergaard, who gave up 10 hits for the second consecutive start. Leadoff batter Jon Berti had three hits and matched a franchise record with four of Miami's six stolen bases — four against Syndergaard.

Miami was 6 for 6 until catcher Wilson Ramos, who didn't start, threw out Harold Ramirez trying to swipe second for the final out of the 10th.

New York's bullpen permitted one hit in six scoreless innings.

Sandy Alcantara carried a shutout into the seventh for Miami before the Mets finally woke up a quiet crowd of 21,766. J.D. Davis hit a leadoff double and Conforto drove an 0-2 mistake to right-centre, cutting it to 4-2.

Conforto went 3 for 4 in his sixth career multihomer game and second this season — both against Miami.

Díaz became the first rookie to homer off Syndergaard and Mets ace Jacob deGrom in the same season.

"That's about probably as good a game as we kind of play. A lot of things went our way," Marlins manager Don Mattingly said. "Obviously, we just can't close it out."

FINALLY!

The only pitcher with more consecutive losses to begin a career than Sewald was Terry Felton, who dropped all 16 of his career decisions with Minnesota from 1980-82. Vic Darensbourg was the lone big league pitcher to have more appearances (123) without a win.

"Just a relief," a smiling Sewald said. "That was a terrible stretch of losses, so just the fact that now I don't have to think about it, talk about it, hear about it, that's the most important thing."

TRAINER'S ROOM

Mets: RHP Robert Gsellman (lat) would probably like to throw more live batting practice, Callaway said, and LF Dominic Smith (foot) could take swings against Gsellman again. But there's no guarantee the team would activate either one off the injured list before the season ends.

UP NEXT

Marlins: Rookie right-hander Robert Dugger (0-3, 4.45 ERA) gets his seventh major league start Wednesday night at Citi Field, still looking for his first career win.

Mets: Bidding for a second straight NL Cy Young Award, deGrom (10-8, 2.51 ERA) makes his final scheduled start this season. The right-hander entered Tuesday leading the league in strikeouts with 248 and WHIP at 0.99. He ranked second in ERA and fourth in innings (197). And he's coming off two consecutive outings of seven scoreless innings.

___

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports