NEW YORK — The Mets don’t care what you think about Major League Baseball’s extra-innings rule. After Tuesday, they’re fans of it.

Taking advantage not only of the man-on-second rule, but also a quirk within it, the Mets came from behind to steal Game 1 of their doubleheader from the Phillies at Citi Field with a 4-3 win on a Jonathan Villar walk-off single.

“I like the rule,” manager Luis Rojas said. “I’ve been part of long games. I don’t think right now, it’s a time for that.”

Because the doubleheader was scheduled to include two seven-inning games, the eighth marked the first “extra” inning at Citi Field, and thus the first in which the teams began with a runner on second base. In most cases, the runner on second is supposed to be the player who made the last out in the previous inning. But in this instance, Rojas had purposely subbed reliever Trevor May into that spot for Dominic Smith in a double switch, knowing the rule stipulates that if a pitcher occupies that slot, a team can use the player before that in the lineup instead.

Thus, Francisco Lindor — not May, Smith or a pinch-runner — began the bottom of the eighth on second base. The move paid immediate dividends when Pete Alonso cracked a game-tying single into left, allowing Lindor to score with ease.

Four batters later, Villar sent a run-scoring hit to left over a drawn-in outfield to give the Mets the win.

“It’s good to see those big hits in those moments,” Rojas said of the Mets, who entered the day batting .146/.351/.171 as a team with runners in scoring position. “You can see the guys’ timing coming together.”

Sharp early, Mets starter Taijuan Walker struck out eight — tied for his most since undergoing Tommy John surgery in 2018 — over 4 1/3 innings of one-run ball. But when Walker walked two of the first three batters he faced in the fifth inning, the Mets turned to their bullpen with mixed results. Miguel Castro escaped that jam, but issued a leadoff walk in the sixth that turned into the game-tying run.

“I’m frustrated at myself,” Walker said. “My goal is to go out there and go as deep as possible … so I’m a little frustrated that I wasn’t able to do that today. But I thought Castro did a good job of coming in and picking me up.”

After taking an early lead on Smith’s two-run homer in the first, the Mets did not score again until the eighth.