NEW YORK -- Thomas Greiss made 40 saves and the New York Islanders won for the first time in four games, 4-2 against the New York Rangers at Madison Square Garden on Tuesday.
Josh Bailey had a goal and two assists and Brock Nelson scored his 20th goal of the season for the Islanders, who were 2-for-2 on the power play.
It was the last game for each team before the All-Star break.
[WATCH: All Islanders vs. Rangers highlights]
The Islanders (29-15-5), who don't play again until Feb. 1, were 0-2-1 in their past three games, including two losses against the Rangers last week, 6-2 at the Garden on Jan. 13 and 3-2 at Nassau Coliseum last Thursday.
"They found a way to get two on us and we knew we needed to get a big one here, especially in such a short amount of time and in their building," Bailey said. "We felt like we owed them one and happy to get it here tonight."
Video: NYI@NYR: Bailey starts the scoring with deflection
Artemi Panarin, the Rangers' leading scorer with 68 points (26 goals, 42 assists), missed his first game this season because of an upper-body injury he's been dealing with for five days that hasn't improved, coach David Quinn said.
"We were kind of 50-50 throughout the afternoon whether he was going to play and by the end of it, it didn't seem like the right thing to do," Quinn said. "We don't think it's long-term."
Panarin, who was to represent the Rangers at 2020 Honda NHL All-Star Weekend at Enterprise Center in St. Louis, will not attend and will be replaced by forward Chris Kreider.
Pavel Buchnevich and Kreider scored power-play goals in the third period for the Rangers (23-21-4), who have lost two in a row. Mika Zibanejad had two assists and Alexandar Georgiev made 14 saves.
The Rangers don't play again until Jan. 31.
"It would have been a lot nicer to leave after a win tonight, but I think these nine days will do us good," Zibanejad said. "We obviously have a whole lot of hockey left to play and the way we're trending, we get this break here, come back, regroup and just go at it when we come back."
Bailey gave the Islanders a 1-0 lead with a power-play goal on a deflection of Noah Dobson's shot from the blue line at 13:35 of the first period.
They connected again on the power play three minutes later when Anthony Beauvillier scored on the rush with a wrist shot to make it 2-0 at 16:35.
The Rangers tried to generate a shorthanded scoring chance, but Greiss made a save on Jacob Trouba, who got stuck in the zone with Ryan Strome, allowing the Islanders a clean 3-on-2 breakout that led to Mathew Barzal (two assists) setting up Beauvillier.
"We made a bad decision," Quinn said.
Anders Lee scored with a one-timer from above the left circle at 9:52 of the second period to give the Islanders a 3-0 lead. Jordan Eberle won a battle for the puck behind the net and Barzal won another in the corner before passing to Lee.
"I got a good bounce on it, but it's those two battles that they won to get me the puck and we got rewarded for it," Lee said.
Video: NYI@NYR: Lee fires shot that finds the twine
Strome thought he scored for the Rangers at 17:58. The Islanders challenged for offside and the goal was overturned on video review, which determined forward Jesper Fast entered the zone illegally prior to the goal.
Nelson made it 4-0 at 3:13 of the third period off a pass from Bailey.
Buchnevich scored at 13:45 to make it 4-1, and Kreider cut it to 4-2 at 15:32. The goals came after Islanders defenseman Scott Mayfield received a four-minute penalty for spearing Brendan Lemieux.
They said it
"I'm ecstatic with the two points. We're exhausted. We had to battle through it. It was huge for our psyche. We've had so many games in a short period of time. We're mentally and physically fatigued, and the break is going to do us good. If we would have lost that game in any way, shape or form, I think it would have been a big punch to the stomach." -- Islanders coach Barry Trotz
"Obviously with [Panarin] in the lineup, our lineup looks a lot different. The other team has to pay more attention to him and he makes the two linemates he has [better]. Really in essence you lose three players, because the two guys he's playing with aren't as good as they would be with him there. It's a blow." -- Rangers coach David Quinn
Video: NYI@NYR: Beauvillier fires PPG after Greiss' save
Need to know
Barzal, who will represent the Islanders at the 2020 Honda NHL All-Star Weekend in St. Louis, was benched in the third period. … The Rangers sent goalie Igor Shesterkin and forward Phillip Di Giuseppe to Hartford of the American Hockey League after the game.
Islanders: Host the Vancouver Canucks on Feb. 1 (Barclays Center, 1 p.m. ET; MSG+, SNP, NHL.TV)
Rangers: Host the Detroit Red Wings on Jan. 31 (7 p.m. ET; ESPN+, MSG, FS-D+, NHL.TV)
Video: Greiss, Bailey lead Islanders to 4-2 win vs. Rangers