Erik Haula and Timo Meier each scored in the first period, and Vitek Vanecek made 24 saves for the Devils (47-20-8), who are four points ahead of the Rangers and one point behind the first-place Carolina Hurricanes, who have one game in hand, with seven games remaining.
Vanecek (30-10-4) became the first Devils goalie to win 30 games in a season since Hockey Hall of Fame member Martin Brodeur in 2011-12. Brodeur had 30 or more wins 14 times.
"You're going game by game and I'm really happy, but I have to get credit to my teammates," Vanecek said. "They always play really good front of me, so that's a big credit for them."
New Jersey, which lost six of its previous eight, won a regular-season series (3-0-1) against New York for the first time since 2017-18 (3-1-0).
"We want to improve our game and then once the playoffs hit, it's obviously a different game," Meier said. "I think for us, it feels good, but if we face them in the playoffs, we've got to be ready to play hard and play a good hockey team."
Igor Shesterkin made 29 saves for the Rangers (44-21-10), who lost for the first time in four games.
"They have a lot of skill and a lot of talent," New York coach Gerard Gallant said. "They are a real good team. They've taken a step and have 102 points. They are a confident group. They work hard and play hard.
"After the first period, we played real well. We've got to come out a little bit better than we did."