It was the second hat trick of Lang's career.
Montreal's Andrei Markov broke a 2-2 tie 2:32 into the third period with a power-play goal and Lang did the rest. He finished off his hat trick by scoring a shorthanded goal into an empty net with 37 seconds remaining.
Roman Hamrlik had three assists and Jaroslav Halak made 36 saves in helping Montreal win for the seventh time in nine games. New York has lost five out of seven.
Chris Drury, Ryan Callahan and Michal Rozsival scored for the Rangers and Henrik Lundqvist stopped 19 shots.
Montreal had lost its four previous trips to Madison Square Garden. The shorthanded goal allowed by New York was the 13th against the Rangers this season, the most surrendered by one team.