Rangers celebrate a goal by center Ryan Strome against the...

Rangers celebrate a goal by center Ryan Strome against the Blues in the second period of an NHL game at Madison Square Garden on Wednesday. Credit: Kathleen Malone-Van Dyke

The Rangers have met every challenge this season, answered every question about them. Whenever they’ve needed a statement win, they’ve gotten it; whenever they’ve had their backs against the wall, they’ve fought their way off it.

They had lost two straight games entering Wednesday but hadn’t lost three straight in regulation all season. They still haven’t.

Only 25¢ for 5 months

Unlimited Digital Access. Cancel anytime.

Already a subscriber?

The Rangers have met every challenge this season, answered every question about them. Whenever they’ve needed a statement win, they’ve gotten it; whenever they’ve had their backs against the wall, they’ve fought their way off it.

They had lost two straight games entering Wednesday but hadn’t lost three straight in regulation all season. They still haven’t.

Down a goal against old friend Pavel Buchnevich and the St. Louis Blues, the Rangers rallied for a 5-3 victory on the strength of three third-period goals — by defenseman Patrik Nemeth, Chris Kreider and Artemi Panarin — to improve their record to 34-15-5.

Rangers goaltender Igor Shesterkin made 29 saves.

"There are going to be certain nights we don’t have it,’’ said Kreider, whose goal was his 35th of the season. "But being able to dig in, and do whatever it takes to win hockey games — I mean, obviously, that’s certainly easier when you’ve got the best goalie in the world [in Shesterkin].

"But at the same time, you know, being able to find our game, being able to forget about bad shift or bad period, not let it stack, not, kind of, letting the frustration overcome us . . . I think those are obviously very important things.’’

The Rangers had led 2-0 late in the second period, but the Blues stunned them by scoring three goals in the final two-and-a-half minutes of the period to take a 3-2 lead into the third.

Even after the victory, coach Gerard Gallant seemed to still be upset about that.

"But we found a way,’’ he said. "Igor was outstanding when he had to be sure.’’

Gallant described the mood in the locker room during the second intermission as "disappointment . . . frustration over basically falling asleep for two-and-a-half minutes.’’

"They were the better team, don’t get me wrong, but I’m saying we were winning 2-0, we’re in control of the game,’’ he said. "If they get one, you can live with that; that happens. But to give up three goals like that, It was pretty discouraging.’’

But Nemeth, playing in his first game since the birth of his son on Friday, scored his first goal as a Ranger, at 7:27 of the third, driving home a long shot into a vacated net with St. Louis goalie Ville Husso (24 saves) caught out of position to tie it 3-3.

Then Blues defenseman Colton Parayko was penalized for shooting the puck over the glass. With 43 seconds left in the power play, Gallant called a timeout, in order to keep his first power-play unit on the ice. It paid off when Adam Fox fired a shot and Kreider deflected it in at 11:40 for the go-ahead goal.

Panarin added his 15th goal of the season into an empty net to seal the result.

The game saw the return of Buchnevich, who played his first game in the Garden since being traded to St. Louis over the summer.

"Playing with him was a lot of fun,’’ Mika Zibanejad said Tuesday of Buchnevich, his longtime linemate with the Rangers. "I have a lot of good memories from it. We had a lot of laughs.’’

It was Buchnevich’s replacement on the first line, Alexis Lafreniere, who opened the scoring, banging in the rebound at 8:55 of the first period for his 13th goal of the season.

Ryan Strome’s goal made it 2-0 at 16:36 of the second, when he took a pass from Panarin behind the left post, walked out across the goal line and fired a short shot underneath the pad of Husso.

But less than a minute later, at 17:30, Ryan O’Reilly drove the net and tapped in a feed from Brandon Saad to get the Blues on the board; then Ivan Barbashev scored at 18:37 and David Perron scored with 15.8 seconds left in the period. And suddenly, the Rangers found themselves in a hole.