Carl Hagelin scored twice, Martin Biron had 32 1.
The Rangers avoided their first three-game losing streak since starting the season 0-1-2.
Hagelin and Ryan Callahan had shorthanded goals in the second period while Marian Gaborik scored on a power play late in the third to seal the win.
Callahan's goal snapped a 1-1 tie and Biron kept Buffalo off the board after that, allowing New York to build a cushion.
Thomas Vanek scored for Buffalo, which fell to 1-1-1 on a five-game homestand, and Jhonas Enroth allowed four goals on 33 shots.