Mandatory Credit: Jeff Curry-USA TODAY Sports

Down to their final out in the ninth inning, it looked like the Mets would end up getting shut out for the first time all season. But there was a little magic in St. Louis, with the Metropolitans rallying for five runs to upset the NL Central leading Cardinals.

Facing closer Giovanny Gallegos, the Mets sent Pete Alonso, Eduardo Escobar, and Robinson Cano to face him.

Gallegos entered with a 1.42 ERA in six appearances this season. He left with a 6.43 ERA.

Alonso flew out on the first pitch he saw. Escobar singled to put the tying run on base, then Cano flew out to left field to bring the Mets to the final out.

Mark Canha stepped up to the plate. In a 3-2 count, Canha slapped a ball to Nolan Arenado at third. Arenado took six steps, fired over to first, and it sailed over the glove of Paul Goldschmidt. Escobar scored and the Mets were down one run.

Jeff McNeil doubled to keep the game going but no runs would come from it with Joey Cora holding the pinch runner Travis Jankowski at third base.

Entering in a pinch-hitting spot, Dominic Smith ripped a ball to first. Goldschmidt snagged it but a hustling Smith dove and beat Gallegos to the bag. In the foray the Mets scored two runs to take a 3-2 lead.

Brandon Nimmo tacked on two more runs with a two-run home run on the first pitch he saw from new reliever T.J. McFarland.

In total, it’s five unearned runs, and one win for the Mets. They lead the majors with 13.

Coming into Monday night, the Mets had won five series in a row and nine of their last 13 games, making them the hottest team in baseball. Their five straight series win also match a franchise record. Should they take this series from the Cardinals, they would have the most series won to start a season their history.

The ninth inning saved the start from Max Scherzer. Scherzer crushed his home-town Cardinals. He went seven innings, allowed two hits, walked one, and struck out 10.

Opposing starter Miles Mikolas was just as strong, completing seven innings, allowing four hits, no runs, and striking out five.

Trevor May took over in the eighth and struggled heavily. He gave up back-to-back singles to Yadier Molina and Harrison Bader to put two on with no outs. He then got the first out of the inning on a ground out of Edman before walking Goldschmidt to load the bases.

Tyler O’Neill then came up and it a two-RBI single to left field that scored Brendan Donovan (pinch running for Molina) and Bader to give the Cardinals a 2-0 lead over the Mets.

May retired the next two batters he faced, but the damage was done as the Cardinals took a 2-0 lead into the ninth. The Mets needed two to tie it and three runs for the win.

Edwin Diaz came on to replace Trevor May on the mound for the Mets in the ninth to try to close it out and get the save. James McCann came in to catch Diaz.

After retiring the first two batters he faced, Diaz walked Andrew Knizner to put a runner on.

But a strikeout of Bader ended the inning as the Mets took a crazy 5-2 win over the Cardinals.

May (1-0) was credited with the win, Gallegos (0-1) got the loss, and Diaz (2) took the save.

The Mets have shown their resiliency multiple times just 18 games into the season. Monday’s could be season-defining. Instead of rolling over on their final strike the Mets sparked to steal a win.

New York has been one of the best teams in baseball this season and Monday was just another way of showing it.

The Mets and Cardinals continue their series in St. Louis Tuesday night at 7:45PM EST. The Mets will be looking to win their sixth straight series.