NEW YORK — Just when the Mets were beginning to build some late-season momentum, three recurring injuries stalled them again.

A.J. Ellis got a big hit in his Philadelphia debut, breaking a seventh-inning tie with a two-run double Sunday that sent the Phillies to a 5-1 victory over New York.

Vince Velasquez and four relievers quieted a streaking Mets lineup that was minus ailing sluggers Yoenis Cespedes (quad) and Neil Walker (back).

New York also lost hot-hitting shortstop Asdrubal Cabrera in the first inning. He exited with soreness in his left knee, a problem area that sidelined him twice earlier this year.

“With the way all of a sudden we’ve played here in the last four or five days, it took a little air out of the balloon,” manager Terry Collins said.

New York had won three straight and six of seven. But after outscoring Philadelphia 21-5 in the first two games of the series, the Mets squandered their chance to sweep and stayed 2 1/2 games behind St. Louis in a tight race for the second NL wild card.

“The way I see it, we won two of three here, won two of three in St. Louis and (we’ve) got a good opportunity here with Miami coming in to do some damage,” Walker said. “Hopefully, all is well with everybody that’s kind of banged up and we can throw a good lineup out there.”

Collins indicated the injuries to Cespedes, Walker and Cabrera could necessitate daily maintenance for the rest of the season.

“We’ll have to continue to monitor how they feel each day,” the manager said.

Cabrera aggravated his knee when he collided with first baseman Tommy Joseph while beating out a bunt single. As Joseph reached for Velasquez’s high throw, Cabrera’s left arm made contact with Joseph’s left hip. Cabrera appeared to twist awkwardly after the collision.

At first it seemed Cabrera hurt his wrist, and he initially remained in the game. But he was noticeably limping as he advanced to second on Kelly Johnson’s single. And after that, Cabrera was removed from the game and escorted to the dugout by trainer Ray Ramirez.

Cabrera missed 17 games with a strained patella tendon in his left knee, returning from the disabled list with Cespedes on Aug. 19. The switch-hitter was batting .438 (14 for 32) with three homers and nine RBIs since returning to the lineup.

Wilmer Flores pinch-ran for Cabrera and scored on Curtis Granderson’s sacrifice fly before remaining in the game at third base. Jose Reyes shifted over to shortstop.

“You’ve just got to keep fighting,” Collins said. “You’ve just got to keep trying to get guys rested, keep them as healthy as you can and if they can’t go, run somebody else out there and you hope that they come through for you when you need them.”

New York scratched out a mere four singles over the final eight innings.

With the score 1-all in the seventh, Philadelphia loaded the bases with nobody out on singles by Joseph, Aaron Altherr and Jimmy Paredes off Robert Gsellman (1-1), who was very effective to that point in his first major league start.

“He’s got good stuff,” Phillies manager Pete Mackanin said. “He really mixed his pitches well. I liked what I saw from him.”

The rookie left to a nice round of applause from the crowd of 32,033, and gave way to Hansel Robles.

Ellis drove Robles’ fourth pitch over Granderson’s head in left field, scoring Joseph and Altherr with his first hit for the Phillies. The veteran catcher was acquired Thursday from the Los Angeles Dodgers in a trade for longtime Philadelphia backstop Carlos Ruiz.

Pinch-hitter Peter Bourjos was hit by a pitch from Robles with the bases loaded, forcing in another run.

Cesar Hernandez added a sacrifice fly to make it 5-1.

David Hernandez (3-3) pitched a scoreless inning for the win.

Philadelphia squandered two chances to score early in the game, when Freddy Galvis was thrown out at home on a failed safety squeeze and Altherr was cut down at the plate on Paredes’ fourth-inning RBI double.

TRAINER’S ROOM

Mets: LHP Steven Matz (shoulder) threw a bullpen and is expected to throw another one before coming off the disabled list to start Thursday against Miami rather than Wednesday, Collins said.

UP NEXT

RHP Rafael Montero (0-0, 11.57 ERA) has the difficult task of facing All-Star RHP Jose Fernandez (13-7, 2.91) in his first big league start of the season as the Mets begin an important four-game series with Miami at Citi Field. Montero will be recalled from Double-A Binghamton on Monday and last pitched in the majors on April 19. He struggled at Triple-A Las Vegas, but had a 1.70 ERA in eight starts at Binghamton.