The Mets' Pete Alonso celebrates with Francisco Lindor after the...

The Mets' Pete Alonso celebrates with Francisco Lindor after the Mets defeated the Cubs in the first game of a doubleheader in Chicago on Saturday. Credit: AP/Nam Y. Huh

CHICAGO — It took 21 innings across more than nine hours, and they managed only six runs (two earned), but the Mets swept the Cubs in a doubleheader Saturday.

They won the opener, 2-1, in 11 innings on Pete Alonso’s sacrifice fly. Then they took the nightcap, 4-3, in 10 innings after Alonso was hit by a pitch with the bases loaded to bring in the go-ahead run.

The Mets (58-34) are 24 games over .500 for the first time since the end of the 2006 season.

With the offense producing so little, pitching paved the Mets’ path to victory. Starters Taijuan Walker (six innings, one run) and Max Scherzer (6 1⁄3 innings, two runs) were strong. The bullpen gave up a lone run (which was unearned) across 8 2⁄3 innings on the day. J.D. Davis, an impromptu first baseman who made a run-saving scoop in the first game, and Yoan Lopez, called up just for the day and the pitcher for the ninth and 10th innings of the second game, had huge contributions.

In the end, it was representative of what the Mets have done so often this season: Pull out unlikely wins with improbable contributions in the moments that matter most.

“Those are games that good teams win,” manager Buck Showalter said. “We got a good club. Just real proud of everybody. There were so many opportunities there to give in.”

Scherzer added: “You could say that about the whole first half. We’ve been doing that left and right: finding little things within a ballgame to win a ballgame. Today was an example of it. That’s contagious.”

The big moment in the second game: With the bases loaded and Frank Schwindel in a full count, threatening to walk to force in the tying run, Lopez got him to ground into a double play to end the game.

The big moment in the first game: Davis made what Alonso called an “absolutely unbelievable play” to keep the Mets alive in the bottom of the 10th.

Adam Ottavino, who got six outs for the first time since 2019, was in a jam, with the potential game-ending run on third base with none out. Nelson Velazquez, the automatic runner on second, had stolen third, which Ottavino did not expect. No matter. “He doesn’t blink,” Showalter said.

For the first out, Ottavino induced a swing-and-miss from Patrick Wisdom on a slider that Ottavino said was sharper than usual and that Davis described as “devastating.” For the second out, he got P.J. Higgins to watch a sinker for strike three.

That brought up Christopher Morel, who sent a ground ball to the left side of the infield. Third baseman Eduardo Escobar made a lunging stop, steadied himself and fired to first, where Davis was waiting.

“I thought he was going to be safe,” Ottavino said. “It felt like it took Esky a little while to get rid of it, and [Morel] is pretty fast.”

The ball took one hop on its way to an outstretched Davis, who was playing first for the fourth time this year. He caught it with a backhanded pick, then did a reverse somersault as he gathered himself.

“It’s a pretty big play right there,” said Davis, who had entered in the top of the 10th for Dominic Smith, who rolled his right ankle and will get an MRI. “I’m not trying to single out one play or anything like that, but it’s one of those plays.”

Usually outwardly mellow, Ottavino offered a fist pump. “I was super-fired up,’’ he said, “because I knew he was out.”

“He’s got a lot more fire burning underneath that — you see those volcanoes?” Showalter said. “He doesn’t erupt, but you know it’s bubbling down in there. You don’t do what he does without it. But he’s also got a real slow pulse.”

That sent the game to the 11th, when Alonso drove in his 76th run (a Mets record for before the All-Star break after he entered the day tied with David Wright’s 74 in 2006) and Edwin Diaz struck out two of his three batters. That punctuated five scoreless innings from the bullpen.

The day started with Walker matching up with a friend, Medford native Marcus Stroman (4 1⁄3 innings, one run). It was Stroman’s first time pitching against the Mets since leaving via free agency last offseason for a three-year, $71 million deal with the Cubs.

Many hours later, the Mets left with a pair of wins.

“It’s so easy to give yourself an effort day off,” Showalter said. “But effort, with these guys, has never been something that wasn’t a part of their DNA. That’s one of the things I’m most proud of. Their effort has always been there, their caring.”

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME