Mats Zuccarello picked the perfect time to net his first overtime goal in almost five years.

In their final game of the year at Madison Square Garden, the reeling Rangers earned a much-needed victory Tuesday when Zuccarello scored a power-play goal at 2 minutes 37 seconds of overtime to lift them to a 3-2 win over the Anaheim Ducks.

“I think we deserved it today, it’s nice to get 2 points again,” said the understated Zuccarello, who last scored in extra time in January 2011, when he notched the first goal of his N.H.L. career to beat Carolina.

The Rangers needed the boost from Zuccarello, their top goal scorer, winning for just the fourth time in their last 15 games.

Henrik Lundqvist, who was pulled after giving up five goals in two periods in a desultory 7-3 loss to Washington on Sunday, made 17 saves.