New York Rangers center Vincent Trocheck (16) deflects a shot...

New York Rangers center Vincent Trocheck (16) deflects a shot in front of Anaheim Ducks goaltender Lukas Dostal (1) during the second period of an NHL hockey game, Sunday, Jan. 21, 2024, in Anaheim, Calif.  Credit: Kyusung Gong

ANAHEIM, Calif. — Pretty, this wasn’t. But it was one the Rangers needed to have.

After losing the first two games of this West Coast road trip, the Rangers had to feel as though they were in must-win mode as they took on the lowly Anaheim Ducks on Sunday at the Honda Center. And here they were, down two goals late in the second period and staring an unthinkable defeat in the face.

But they dug deep, and they started chipping away. And they pressed, and pressed, and pressed, and ultimately, the Ducks — the team with the third-fewest points in the league — caved in.

The Rangers rallied with five straight goals, including four in the third period, and ended up with a 5-2 win over Anaheim that gave them their first victory on the trip, which concludes Tuesday in San Jose.

Artemi Panarin scored what proved to be the winning goal on a power play at 14:23 of the third period after Vincent Trocheck’s power-play goal started the comeback late in the second period and rookie Will Cuylle’s goal tied it at 2-2 at 10:10 of the third.

Chris Kreider added an insurance goal at 16:07 and Jimmy Vesey scored into an empty net with 35.5 seconds remaining to puff up the winning margin.

“It’s one of those games . . . when you just have to find a way to reset and try to battle back and not feel sorry for yourself,’’ center Mika Zibanejad said of the Rangers’ slow start. “I think that’s something that the whole team, the whole group did a good job of, just kind of staying with it.’’

“Resilient,’’ coach Peter Laviolette said. “I mean, we worked tonight. That win was hard. We thought we were controlling most of the game, but that doesn’t matter. You find yourself down one, down two . . . and the resiliency, I think, just to stay in there and keep fighting, and keep working, and keep pushing . . . I thought was a really great job by the guys.’’

The Rangers (29-15-2) appeared to fall behind 3-1 on a goal by Mason McTavish 5:18 into the third period, but Laviolette challenged the goal, alleging the Ducks (15-30-1) had been offside entering the offensive zone. The challenge was successful and the score remained 2-1.

Then Cuylle, who was banging bodies all game and crashing the net, got his stick on a shot by Jacob Trouba and tipped it in past Lukas Dostal for his eighth goal.

“I was kind of pinned in the corner and just tried to fight to get to the front of the net,’’ Cuylle said. “And obviously, it was a good shot by Troubs to get it through, and I just tried to get a stick on it.’’

Cuylle made another big play after that when he drove the net and was tripped by McTavish, giving the Rangers a power play with 5:51 remaining in the game. At that point, they were starting to feel confident that they’d finish the comeback.

“Yeah, 100%,’’ Cuylle said. “Our power play was great today [going 2-for-4]. They were getting chances all game, and when we drew that penalty, I was pretty excited for what was going to come.’’

What came was a feed from Adam Fox to Panarin for a one-timer from the bottom of the left wing circle for the Russian’s 28th goal. He is tied with fellow Russian Nikita Kucherov for fourth-most in the league.

Two first-period goals by Adam Henrique, at :51 and 15:37, put Anaheim in control after the opening 20 minutes.

Laviolette shook up his forward lines, including breaking up the Panarin-Trocheck-Alexis Lafreniere line, and it seemed to be effective. Trocheck’s power-play goal got the Rangers on the board at 17:58 of the second period.

“You come out and it’s not going the way you want, sometimes you can just move the lines a little bit,’’ Laviolette said. “I don’t think I touched the [Jonny] Brodzinski line [with Cuylle and Blake Wheeler]. That line stayed intact because I really liked what I saw from them. We just moved some other pieces around and just tried to get the most out of the bench.’’

More Rangers

Newsday LogoSUBSCRIBEUnlimited Digital AccessOnly 25¢for 5 months
ACT NOWSALE ENDS SOON | CANCEL ANYTIME