A power-play goal by Mark Giordano with 4:09 left in the opening period created a 2-2 tie and that is the way it stayed until McDonagh barely beat the overtime horn by putting a wrist shot past Henrik Karlsson.
The Rangers won their second in a row after losing their first three games of the season.
Brandon Prust put the Rangers back in front on a shorthanded tally with 6:18 left in the first.
Henrik Lundqvist stopped 32 shots for the Rangers. Karlsson made 25 saves.
Iranian woman stops the execution of son's killer
Disney's 'Jessie' to feature network's first engagement