By Sam Bush

Brandon Nimmo’s pinch-hit, three-run homer in the bottom of the 10th lifted the the Mets to a 3-0 victory over the visiting Phils.

Amed Rosario began the winning rally with a two-out double off Mark Leiter Jr. (0-1) — the first hit for the Mets since the fourth inning. Jose Reyes walked and Nimmo drove Leiter’s next pitch well over the wall in right-center for his first career walk-off RBI.

New York won for only the fifth time in its past 24 home games. The Mets earned a four-game split but have gone 15 consecutive series without winning one since sweeping a three-game set against Arizona from May 18-20.

The Phillies dropped back into a first-place tie with Atlanta in the NL East.

In his final scheduled start before heading to the All-Star Game next Tuesday in Washington, Jacob deGrom scattered five hits over eight innings and matched his longest outing of the season. He struck out seven and lowered his major league-leading ERA to 1.68, tied with Dwight Gooden (1985) for the best by a Mets starter before the All-Star break.

Phillies starter Vince Velasquez returned from the disabled list and matched deGrom, allowing two hits over six scoreless innings. The right-hander missed only one start after being hit just below the right elbow by a line drive on June 30.

“Super tough loss,” Phils manager Gabe Kapler said. “(Velasquez) went toe-to-toe with one of the best pitchers in baseball. He did as good of a job as we could have possibly asked of him coming off 10 days down, really giving us everything he had.”

The Phillies had a threat mounting in the 10th, but catcher Andrew Knapp was thrown out attempting to move from first to third on Cesar Hernandez’s infield single.

“We teach aggressiveness,” Kapler said. “He made an aggressive play and I stand behind it.”

Robert Gsellman (6-2) pitched a scoreless inning for the win.