The Maple Leafs had built a 3-1 lead when the Rangers responded with goals from Rick Nash 2:50 into the final frame, and from Derek Stepan, who tallied at the 9-minute mark.
But only 38 seconds after the equalizer, Tyler Bozak tracked down the puck in the New York zone and found Kessel alone in the slot. The Toronto right wing put his own rebound past Henrik Lundqvist for his second goal of the game.
Kessel added an assist while James Van Riemsdyk supplied a goal and a helper for Toronto, which holds the fifth playoff seed in the Eastern Conference.
James Reimer made 31 saves to earn the victory.
Nash netted two goals and Stepan added an assist for eight-seeded New York.
Lundqvist finished with 24 stops.