By Sam Bush

Jean Segura homered in his first two at-bats, Aaron Nola snapped a nine-start winless streak and the surging Phillies beat the New York Mets 5-3.

Bryce Harper drove in two runs as the Phils won their fourth in a row and pulled within one game of NL East-leading Atlanta and 2 1/2 of the second wild card.

The Phillies had lost eight of 11 prior to their current streak.

“It’s a resilient group that has found a way to bounce back,” Phillies manager Joe Girardi said. “Just keep playing well, worry about ourselves and we’ll go from there.”

Segura homered in the first inning and again in the third off Carlos Carrasco (1-3) for his sixth career two-homer game and first since Sept. 26, 2016, when he went deep twice for the Arizona Diamondbacks against the Washington Nationals.

The 31-year-old is hitting .325 with four homers in 11 games against the Mets this season and is a career .361 hitter at Citi Field with four homers and 13 RBIs in 22 games.

“I see the ball really good when we play these guys,” Segura said.

Nola (8-8), who was 0-2 with a 5.10 ERA since his previous win July 25, allowed four hits and walked one with nine strikeouts in 5 2/3 innings.

“For myself, it’s gone up and down, but I throw that away,” Nola said. “We’re in a race right now. Any way I can help and go out, do my job as best I can is what I’m going to do.”

Nola carried a shutout into the sixth, when Brandon Nimmo tripled with one out and scored on Francisco Lindor’s grounder. He was pulled after walking Pete Alonso and Jose Alvarado struck out Michael Conforto on three pitches.

“I thought he pitched an outstanding game,” Girardi said of Nola. “I just thought he was running out of gas.”

Brad Miller and Freddy Galvis greeted Brad Hand with back-to-back doubles in the seventh. Harper hit a two-run, two-out double off Trevor May to extend the lead to 5-1.

Dominic Smith had a pinch-hit RBI single in the Mets seventh. Nimmo homered leading off the eighth.

Ian Kennedy threw a perfect ninth to earn his 24th save.

Carrasco allowed two runs on five hits and two walks with five strikeouts in six innings. He likely would have pitched the seventh but fouled a pitch off his thumb while batting in the fifth.

“I couldn’t hold the ball,” Carrasco said. “That’s why they took me out.”