NEW YORK (CBSNewYork/AP) — Things looked bleak for the Blueshirts until a fever-pitch comeback in the final minutes of the third period Tuesday night.

Kevin Hayes scored on a short-handed breakaway with 40 seconds remaining and the New York Rangers rallied to beat the Anaheim Ducks 3-1.

Vladislav Namestnikov had a goal and two assists, and Filip Chytil added an empty-netter in the Rangers’ three-goal third period. Alexandar Georgiev, called up on Sunday after a stint in the minors, stopped 14 shots to help New York win for the second time in eight games (2-3-3).

Pontus Aberg scored on a deflection in the second period for the Ducks, who had won nine of their previous 10 games. Chad Johnson, claimed off waivers from St. Louis on Dec. 11, finished with 21 saves in his Anaheim debut.

With Chytil in the penalty box for interference on Johnson, Hayes skated up the left side, cut in and fired a shot that the goalie got a piece of, but the puck got through and across the goal line for his ninth. It gave Hayes four goals and 10 points in his last five games.

Chytil then came out of the box and scored into an empty net with 19 seconds remaining to seal the win.

Trailing 1-0 after two periods, the Rangers came out aggressive in the third period and outshot the Ducks 14-1 over the final 20 minutes. After falling short on several chances in the first half of the period, the Rangers broke through near the midpoint.

Brett Howden brought the puck along the boards on the left side, skated toward the corner and sent a centering pass to Namestnikov, who cut between two Anaheim players and beat Johnson from the left side for his fourth at 9:52.

The Rangers finished 0 for 3 on the power play, and the Ducks were 0 for 5.

Neither team could muster many chances through the first two periods, with Anaheim holding a 14-10 edge on shots on goal.

Mats Zuccarello was denied by Johnson on a tip try in front 1:07 into the second. Georgiev stopped an attempt by Getzlaf from the left circle about seven minutes later.

Boo Nieves had a breakaway with about nine minutes remaining in the middle period, but his shot from the right circle was gloved by Johnson. Chris Kreider also had a chance from the left circle, but fired the puck right into the Ducks’ goalie with 6½ minutes to go.

Anaheim got on the scoreboard with 5:51 left as Aberg’s centering pass from behind goal line went off Rangers forward Mika Zibanejad’s skate and past Georgiev for his 11th of the season.

The Ducks had a chance to double the lead as Getzlaf passed the puck off his skate to Ondrej Kase cutting to the net, but Georgiev made a nice sliding save to his left with just under four minutes remaining in the middle period.

Keifer Sherwood hit a goalpost for the Ducks 3:13 into the game, and Nieves did the same a little more than seven minutes in.

New York’s best chance in the first came as Kevin Hayes missed wide from the right side on a short-handed rush with 5:48 left, and Vladislav Namestnikov got the rebound off the end boards on the left side, but his backhand try was stuffed by Johnson.

NOTES:

The Rangers won for the eighth time in the teams’ last 10 meetings, including 3-2 in a shootout at Anaheim on Nov. 1. Georgiev was making his first appearance for the Rangers since finishing with 36 saves in a 5-2 loss at Montreal on Dec. 1.

UP NEXT:

The Rangers visit Toronto on Saturday night.

(© Copyright 2018 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)