In the past, Dylan McIlrath may have hesitated. Not last night.

With the Oilers having tied the Rangers about five minutes into the second period, McIlrath took a set-up pass from fellow defenseman Keith Yandle, wound up and blasted a one-timer from the left point past goaltender Anders Nilsson to restore the lead at 7:54. It was his first NHL goal in his 16th game. The Rangers, who had lost three straight on the road, never looked back, defeating the streaking Oilers, 4-2, at the Garden.

“It was a long time coming,” said McIlrath, 23. “I was pretty close the last two games, but I’m pretty thankful it went in. I just tried to bear down and get it clean off my stick. It didn’t really register till I saw the reaction on guys’ faces.”

StoryWild claim Jarret Stoll

McIlrath, a rugged 6-5 defenseman, was known as “The Undertaker” for his willingness to drop the gloves in junior hockey and the minors. He has been developing some offense, a trait that can only help him stick in New York.

“That shot of his is a huge strength,” Ryan McDonagh said. “You can see him gaining more confidence with the puck on his stick in the offensive zone, that’s a great sign.” Said Henrik Lundqvist: “He’s growing with each game.”

McIlrath played a season-high 18:38. He credited his big minutes in the AHL playoffs in Hartford last season and his NHL partner Yandle, who also assisted on Mats Zuccarello’s opening goal, for the new element in his game.

advertisement | advertise on newsday

“It’s night and day,” from his early years, he said. “Playing with Keith this year, you’re in the offensive zone so much more.”

The win, keyed by an outstanding defensive effort, also included the NHL debut of another rookie defenseman, 21-year-old Brady Skjei, who was called up to replace Dan Girardi (knee). The Blueshirts, who allowed 14 goals in the three-game Canadian trip that included a 7-5 loss in Edmonton, improved to 19-9-4 and 13-4-1 at home.

The Rangers led 3-2 after two periods on goals from Zuccarello, scoring in his third straight game, McIlrath and Rick Nash. They survived three penalties early in the third, without allowing a shot on two of the opportunities. Jesper Fast’s empty-netter with 3.2 seconds remaining salted it away.

“This was just so needed, this win, for so many reasons,” said Lundqvist, who had 18 saves. “The way we had to battle, and the penalty kill did a great job.”

The Rangers led 1-0 after the first, but four goals were scored in the second.

With Oscar Lindberg off for roughing, Taylor Hall closed in on the left and beat Lundqvist far side for the 1-1 tie at 5:12.

After McIlrath’s goal at 7:54, Skjei, who had been solid, coughed up the puck in mid-ice, triggering a breakaway goal by Jordan Eberle at 18:20 for the 2-2 tie. The game-winner came 13 seconds after the Oilers were whistled for too many men on the ice. Nash, at the right post with 39 seconds left in the period, put the Blueshirts ahead 3-2.

“To get the win was the best part for sure,” said Skjei, who played 14:54. “Made a little mistake in the second, but thought I battled back. It happens, bad bounce, you just got to put it behind you as fast as you can.”