Updated

The New York Mets found late magic Thursday night off the bat of Pete Alonso, who launched a ninth inning home run into the Milwaukee night that led to a miraculous Mets comeback.

The Mets came from behind to beat the Milwaukee Brewers, 4-2, to advance to the National League Division Series. The best-of-3 series-clinching wild card win sends the Mets to Philadelphia, where the Mets and Phillies begin the NLDS on Saturday.

New York didn’t make things easy on themselves Thursday night in Milwaukee.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Trailing 2-0 in the top of the ninth and two outs from elimination, New York rallied against Devin Williams to steal a 4-2 victory over the Milwaukee Brewers and move on to the National League Division Series.

Francisco Lindor opened up the inning with a walk, and two batters later, Brandon Nimmo singled to put runners on the corners — that had been the first hit by a Met other than Lindor on the night, as Lindor had been 2-for-3, but everyone else combined to go 0-for-24.

Pete Alonso

Pete Alonso #20 of the New York Mets celebrates after hitting a home run in the ninth inning against the Milwaukee Brewers during Game Three of the Wild Card Series at American Family Field on October 03, 2024 in Milwaukee, Wisconsin.  (Patrick McDermott/Getty Images)

That brought up slugger Pete Alonso. The righty laced a pitch to opposite field that crept over the right field wall to give New York a 3-2 lead, causing pandemonium in the dugout and on the basepaths.

Starling Marte added an RBI single for good measure to pad the lead. 

Because Edwin Diaz had pitched a part of the seventh and the entire eighth with the Mets trailing, the Mets brought in David Peterson for the save. He promptly allowed a leadoff single to Sal Frelick, who went back-to-back with Jake Bauers in the seventh, but he struck out Joey Ortiz and got Brice Turang to ground into a 6-6-3 double play to give the Mets the series victory.

The miraculous victory is déjà vu for the Mets as it comes just three days after the Mets fought back from down 3-0 in the eighth, and 7-6 in the ninth, against the Atlanta Braves to clinch a postseason spot in their first game of a doubleheader.

Pete Alonso drives one

New York Mets' Pete Alonso hits a three-run home run during the ninth inning of Game 3 of a National League wild card baseball game against the Milwaukee Brewers Thursday, Oct. 3, 2024, in Milwaukee.  (AP Photo/Morry Gash)

PADRES' FERNANDO TATIS JR. DANCES SHIRTLESS IN LOCKER ROOM CELEBRATION AFTER WINNING WILD-CARD SERIES

Everything looked like it was down the drain for the Mets, who, after pulling Jose Quintana following six scoreless innings, allowed back-to-back homers to start the seventh inning. However, Alonso's blast was the first in MLB history by a player when his team was trailing in the 9th inning or later of a winner-take-all postseason game, according to OPTA Stats.

This also marks the first time since 2006 that both the Mets and New York Yankees are in the division series - it's not too early to wonder about a Subway Series, right?

Pete Alonso celebrates

New York Mets' Pete Alonso celebrates his three-run home run with Brandon Nimmo (9) and Francisco Lindor (12) during the ninth inning of Game 3 of a National League wild card baseball game against the Milwaukee Brewers Thursday, Oct. 3, 2024, in Milwaukee.  (AP Photo/Morry Gash)

CLICK HERE TO GET THE FOX NEWS APP

The Mets will now face their NL East rival Philadelphia Phillies in the National League Division Series. Philly is the No. 2 seed in the NL, and it's the first time the two teams have ever faced off in the postseason.

The season series was as tight as it gets, with Philly winning seven of their 13 games. The series begins in Philadelphia on Saturday at 4:08 p.m. ET.

Follow Fox News Digital’s sports coverage on X, and subscribe to the Fox News Sports Huddle newsletter.