NEW YORK — Ryan Howard and the Philadelphia Phillies aren’t finished.

Howard hit a go-ahead homer with two outs in the ninth inning and the Phillies rallied to beat the New York Mets 3-2 on Wednesday night, adding a dramatic victory to their late-season playoff push.

“He was kind of due,” Phillies manager Charlie Manuel said. “He needed a big hit like that, and he came through.”

Jimmy Rollins led off the game with a home run, but Philadelphia went into the ninth with only two hits. Chase Utley worked a two-out walk on a full-count pitch from rookie Josh Edgin (1-2), filling in for ailing Mets closer Frank Francisco, and Howard launched a 93 mph fastball off the facing of the second deck in right field to give his team a 3-2 lead.

“It meant something to us, and it also meant something to him. I’m sure that will give him a big boost,” Manuel said.

Trying for a last-gasp postseason charge after a miserable first half, the surging Phillies (75-74) won for the 10th time in 13 games. They remained four games behind St. Louis for the second National League wild-card spot, with two other teams in between.

“To be here is a testament to the character of this team — that we don’t give up,” Howard said. “It’s a 162-game season and we’re just going out here trying to play it all out.”

The big slugger pumped his fist as he rounded first base and Phillies players broke into a happy frenzy on the bench. It was Howard’s 11th homer in an injury-shortened season and first since Aug. 31.

Edgin had not allowed an earned run since Aug. 19, putting together 16 straight scoreless appearances.

“That’s the Howard that we’ve grown accustomed to,” Phillies pitcher Cole Hamels said.

Hamels equaled a season high with 10 strikeouts over six innings and left trailing 2-1. Philadelphia’s young bullpen kept it close, and Jeremy Horst (2-0) got Andres Torres to ground into an inning-ending double play with the bases loaded in the eighth.

Jonathan Papelbon worked a one-hit ninth for his 36th save in 40 tries. Left fielder Domonic Brown, who had just shifted over from right, helped out with a diving catch in the corner.

The punchless Mets wasted a splendid outing from Matt Harvey, who finished his rookie season with a flourish. David Wright hit a solo homer but the Mets (66-82) dropped their eighth straight home game and 24th in the last 28 at Citi Field.

This one guaranteed them a fourth consecutive losing season, despite a 46-40 first half.

One night after the teams were rained out at Citi Field, Rollins gave the Phillies another quick start when he homered to right on Harvey’s fifth pitch. It was his 43rd career leadoff shot and sixth this season.

Rollins, who homered and scored twice in Monday night’s 3-1 victory over the Mets, has 22 home runs this season and seven this month — five in the last eight games.