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.
Boston schools pull out free condoms over wrapping complaints
Aaron Carter is still in love with Hilary Duff