The Rangers bench celebrates their overtime victory against the Minnesota Wild...

The Rangers bench celebrates their overtime victory against the Minnesota Wild at Madison Square Garden on Wednesday. Credit: Jim McIsaac

Say this about the Rangers: They’re making this playoff race exciting.

Back home at Madison Square Garden after a somewhat disappointing trip to California last week, the Rangers were under pressure to beat the Minnesota Wild on Wednesday night and keep pace with the idle Montreal Canadiens, who held the last playoff spot in the Eastern Conference.

And after a crazy, back-and-forth game, they did what they needed to do, thanks to Vincent Trocheck’s goal 24 seconds into overtime that gave them a 5-4 victory and pulled them into a tie with the Canadiens for the second and final wild-card spot.

Trocheck redirected in a pass from Artemi Panarin for his 22nd goal of the season.

The Rangers (36-32-7, 79 points), who won their second straight, have seven games remaining. Montreal (35-30-9) has eight left. Columbus (34-30-9, 77 points) trails the Rangers and Montreal by two points, but have two games in hand on the Rangers.

“Those are the fun games,’’ said defenseman K’Andre Miller, who had an eventful game that included getting an assist on Trocheck’s game-winner. “Those battles, back and forth, being down a goal, up a goal — personally, I think those are the most fun games to battle until the last whistle. And you saw that tonight.’’

“We needed to win, [and the] guys found a way to do that. So it was it was good to get a ‘W’ in a game that went up and down, and kind of went back and forth,’’ coach Peter Laviolette said. “But through the course of the 60 minutes, or 61 minutes, I thought we pressed most of the night and pushed most of the night.’’

The Rangers, who outshot Minnesota 39-24, carried a 4-3 lead into the third period, but Marco Rossi tied it 22 seconds into the period when he intercepted Miller’s pass in the Rangers’ zone and fed it to Matt Boldy for a point-blank shot that Igor Shesterkin (20 saves) stopped. But Rossi put in the rebound to tie it 4-4.

The Rangers had a chance to win in regulation when Marcus Foligno was called for tripping Miller at 15:52, giving them a power play with 4:08 remaining. The power play, though, failed to score. It was 0-for-4 on the night and is now 1-for-26 over the last 10 games.

The game featured the NHL debut of 19-year-old Gabe Perreault, who had signed with the Rangers on Monday after his season with Boston College ended with a 3-1 loss to defending champion Denver in the NCAA quarterfinals.

Perreault, who played 13 minutes, 38 seconds, and had three shots on goal in his debut, described the game as “super fun.’’

“Obviously, playing in this building is something I’ve never done before and to finally get to be able to do it was unreal,’’ he said.

The Rangers, who were outshooting Minnesota 11-1 in the first period when Alexis Lafreniere was called for an interference penalty that gave the Wild the game’s first power play. And Minnesota capitalized with Gustav Nyquist’s tap-in goal at 9:00. A shot by Boldy had broken the stick of Miller, but the puck went behind the net, and Adam Fox retrieved it and passed to Trocheck.

Miller went to the bench for a line change, but Trocheck partially fanned on his clearing attempt, and former Ranger Mats Zuccarello picked off the puck and sent it to Marcus Johansson, who sent it to Nyquist.

The Rangers tied it on a rebound goal by Braden Schneider at 12:45, but Brock Faber put Minnesota back in front when his slap shot deflected off the stick of Perreault and got past Shesterkin at 15:00.

Miller tied the game with a wicked slap shot from a sharp angle near the left wing boards at 2:51 of the second period. Chris Kreider, playing on the fourth line, gave the Rangers their first lead with his 20th goal to make it 3-2 at 7:21.

Minnesota re-tied it on a shorthanded goal by Johansson at 9:50, but Panarin scored on a breakaway with 1:04 left in the period to send the Rangers into the second intermission with a 4-3 lead. The goal was unassisted, but Panarin got the puck in the neutral zone after Miller checked the stick of Rossi, forcing him to cough it up.

Notes & quotes: Second-year forward Will Cuylle was presented before the game with the Steven McDonald Extra Effort Award, which goes annually to the player who “goes above and beyond the call of duty,’’ as voted by the fans . . . TNT announced it will reunite retiring Rangers play-by-play man Sam Rosen with his longtime partner, John Davidson, in the broadcast booth for next Wednesday’s game against Philadelphia

. . . Trocheck won all 13 of his faceoffs.