NEW YORK – Travis d’Arnaud snapped an eighth-inning tie with a two-run double and the Mets overcame an early injury to starter Jonathon Niese, beating the skidding Texas Rangers 6-5 Friday night to stop a four-game slide.

Lucas Duda hit a two-run homer, and the Mets opened a 10-game homestand with their second victory in nine games. Niese left in the first inning with a bruised lower back after he was hit by Alex Rios’ line drive. The X-rays were negative, the team said.

Star third baseman David Wright missed his seventh straight game with a sore left shoulder, but fill-in Eric Campbell had three hits and an RBI. Carlos Torres, pressed into long relief when Niese was injured, gave up two runs in 42/3 valuable innings.

Jenrry Mejia (5-3) retired Rios with two runners in scoring position to end the eighth. Mejia allowed an RBI single to Adam Rosales in the ninth before retiring pinch hitter Robinson Chirinos on a tricky popup to finish a plodding game on Fireworks Night that took 4 hours, 8 minutes.

Shin-Soo Choo hit a leadoff homer, and Adrian Beltre also went deep for the Rangers, who have dropped six in a row and 14 of 16. Their 10-game losing streak on the road is the club’s longest since a 12-game skid in 2003.

Bobby Abreu drew a leadoff walk from Aaron Poreda (2-1) in the eighth, and Campbell singled off Jason Frasor with one out before d’Arnaud sent a drive up the alley in right-center.

Texas ace Yu Darvish, pushed back a day because of rain Thursday in Baltimore, entered with dominant stats against NL teams. But he was off in this one, allowing four runs and five hits in five innings.

Choo hit his second leadoff homer of the season on Niese’s third pitch.

Moments later, Rios’ drive nailed Niese on the left side of his lower back. He recovered in time to get Rios at first base — the only out he got — before manager Terry Collins, pitching coach Dan Warthen and trainer Ray Ramirez came out to check on the left-hander.

Niese repeatedly told Collins he was fine, but was removed without trying a warmup pitch. An angry Niese fired his glove against the dugout wall and knocked over a bucket of bubble gum before disappearing down the tunnel.

The team’s most reliable starter this season, Niese was done after 12 pitches. He has gone 21 straight starts without allowing more than three earned runs — the longest active streak in the majors.

Abreu hit a two-out RBI single in the first, and Duda followed with his 13th homer, an opposite-field drive to left that originally was ruled in play after the ball ricocheted off the top of the wall and a railing just above it. With Duda standing on second, the umpires huddled and correctly changed the call. They never went to instant replay — though one was shown on the big video screen in center field as they talked it over.

Choo walked and scored on a single by Rios in the third. Duda chugged home from first on Campbell’s fourth-inning double, but the Mets wasted an opportunity to add on.

Beltre hit a solo shot to straightaway center off Torres in the fifth, and Texas tied the score at 4-4 with an unearned run off Jeurys Familia in the seventh.

Elvis Andrus had three hits for the Rangers. Darvish doubled to the left-center fence for his second hit in 11 major-league at-bats — the first for extra bases.

Note: Rather than risk a weather-related flight delay, the Rangers bused from Baltimore to New York after Thursday night’s loss. Manager Ron Washington said it took about 3 hours, 15 minutes, and the team arrived around 3:30 a.m. … Mets right-hander Dillon Gee (strained right lat) went six innings in a rehab start for Class-A Brooklyn, striking out 10. He threw 75 pitches and gave up one run and three hits. … Before the game, there was a video tribute and a moment of silence for former Mets general manager Frank Cashen, the architect of their 1986 championship team. Cashen died Monday, and the Mets are honoring him by wearing a memorial patch with his initials on their sleeves. … Wright and the Mets had targeted Friday for his return, but rain prevented him from going through a full pregame workout on the field, so the team decided to hold him out. He hoped to play Saturday.