The Rangers' Artemi Panarin celebrates with teammates after scoring against the Montreal...

The Rangers' Artemi Panarin celebrates with teammates after scoring against the Montreal Canadiens during the third period of an NHL game in Montreal on Saturday. Credit: AP/Graham Hughes

MONTREAL — As the frustration level continued to rise after the Rangers kept getting  stoned by hot goalies  and losing games they thought they should have won, the players and coach Mike Sullivan  kept repeating that if they kept generating the chances they had been, the goals eventually would come.

They came Saturday night in the finale of their two-game road trip, and the relative offensive explosion helped them rally from an early two-goal deficit in a badly needed 4-3 victory  over the Montreal Canadiens at the Bell Centre.

“It would be really easy just to kind of feel sorry for ourselves for the past few games,’’ said Mika Zibanejad, who scored the Rangers’ first goal on a power play midway through the first period. “And I think I’ve said this multiple times, [it would be bad] to start cheating the game, start sacrificing some defense to get some more offense and whatnot.

“But I feel like because we’ve been getting our looks just because we’ve been playing the way we’ve been playing, I think there’s a belief in this group that we’re right there ... And seeing the result today was huge.’’

The Rangers also got goals from Artemi Panarin — who had three assists — J.T. Miller and rookie defenseman Matthew Robertson, whose first NHL goal gave them a 3-2 lead at 4:11 of the third period.

Panarin entered Saturday with no goals and two assists through six games. He finally scored his first goal — a precise dart into the far corner from the right wing after Zibanejad skated the puck up the middle and dished it to him — at 5:51 of the period.

Panarin’s goal gave the Rangers a 4-2 lead, and it turned into the game-winning goal when former Islander Noah Dobson scored his first goal in a Montreal uniform to pull the Canadiens within 4-3 at 8:26.

Jonathan Quick made 20 saves for the Rangers (3-3-1), who ended a three-game losing streak. They went 1-0-1 on the road trip.

The Rangers fell behind 2-0 before the game was four minutes old. Robertson failed to keep a puck in at the left point and the Canadiens wound up going on a two-on-one break, with Juraj Slafkovsky converting a feed from Cole Caufield to open the scoring at 1:33. Nick Suzuki made it 2-0 with a power-play goal at 3:42.

But Zibanejad — who entered the game with one goal on a team-leading 24 shots — scored on the power play when he blasted a one-timer off a pass from Adam Fox (two assists) that beat Montreal goalie Sam Montembeault at 11:56.

“It felt good . . . and then, obviously, seeing it go in,’’ Zibanejad said. “So it was nice.’’

Zibanejad’s 4.2% shooting percentage coming in was the lowest of anyone who had scored a goal this season, and on top of that, he whiffed on a shot in overtime in Toronto on Thursday that led directly to the Maple Leafs breaking two-on-one the other way for Auston Matthews’ game-winning goal. So for him to be the guy who got the goal that started the comeback was big.

“I was happy for Mika,’’ Sullivan said. “I thought he played terrific tonight. I think he’s had a really strong start to the season, and it may not look like it just from a sheer numbers standpoint ... but he’s just playing the game the right way.

“That one-timer on the flank is a goal-scorer’s goal. The play he made on [Panarin’s] goal, just carrying it through the neutral zone, is a high-end play. And he’s defending. He’s defending hard.’’

After a scoreless second period, the third started with the Rangers on the power play for the first 32 seconds. And with Quick banging his stick at the other end of the ice to let his teammates know the penalty was about to expire, Fox sent a wrist shot into traffic that deflected off Miller and in. That tied it at 2-2 two seconds after the power play ended.

Robertson’s one-timer from the blue line off a pass from Panarin put the Rangers in front 3-2 at 4:11. A minute and 40 seconds later, Panarin scored to make it 4-2.

“We feel like we played like a team tonight,’’ Panarin said. “And everyone was happy for each other for someone doing small things like ... chipping pucks in the zones.’’

Notes & quotes: F Conor Sheary played in his 600th career NHL game . . . F Jonny Brodzinski and D Scott Morrow were the scratches . . . D Carson Soucy (upper-body injury) skated in a full-contact jersey Saturday and could play Monday against Minnesota at the Garden . . . Sam Carrick engaged in a spirited fight with Montreal tough guy Arber Xhekaj in the second period.

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME