Timo Meier had a goal and an assist, Jesper Bratt had two assists, and Markstrom made 21 saves for the Devils (11-4-1), who lost for the first time in eight home games this season (7-0-1).
"That's not the style of game we want to play," Meier said. "It might be fun for the fans, but we’ve got to maintain more time in their zone. We didn't do a good enough job; it was like a pingpong match. We'd get in the offensive zone, get a shot from the outside, and it went the other way.
"We have to go on the forecheck, hold on to the puck, protect it, create and wear them down defensively so they have to defend tired. We didn't do a good enough job of that."
Palmieri had given the Islanders a 2-1 lead on the power play at 17:07 of the third, scoring on a rebound in the crease after Markstrom stopped Matthew Schaefer’s point shot.
"I think that's going to be the team we're going to be this year," Barzal said. "Games are not going to be pretty and those are ones you’ve got to find a way to win. That's how teams get into the Stanley Cup Playoffs. I think the overall effort was encouraging."
Meier put the Devils ahead 1-0 on the man-advantage at 2:12 of the first period, scoring on a snap shot from the slot. After the Islanders were called for too many men just 38 seconds into the game, New Jersey maintained possession in the New York zone for 1:12 before Meier scored his fifth of the season.
"We didn't do enough to generate high-quality scoring chances," New Jersey coach Sheldon Keefe said. "I thought we played a good game, defended well, but we made more mistakes than we scored goals. Big mistakes on all three goals and when the game is that tight, you can't make those mistakes."
Horvat responded to tie it 1-1 on a wrist shot from the slot at 6:55 of the second period after collecting Palmieri’s pass from the right boards following a New Jersey turnover in the neutral zone.
"I thought our guys were unbelievable on the penalty kill," New York coach Patrick Roy said. "I mean, the blocked shots (19 by the Islanders for the game) and when it wasn't there, Ilya was phenomenal. He made some unbelievable saves for us, kept us in that game late, and gave us a chance."