For one night at least, the Rangers held onto a third-period lead.

Derick Brassard scored the go-ahead goal 5:46 into the third and Chris Kreider added an empty-netter with 1:48 left to give the Rangers a 4-2 win last night at Madison Square Garden.

Tied at 2 early in the third, the puck squirted out from the right wall where Ryan McDonagh was battling to keep the play alive and J.T. Miller flipped a touch pass to Brassard, alone in front.

He calmly went to his forehand and beat Devan Dubnyk with a low shot near the post. Both Miller and McDonagh had scored in the second to rally the Rangers, who trailed 2-0 at the end of the first period.

With that lead in the final period, all the Rangers had to do was either score again or hold on. It had not been easy recently.

On Tuesday, in the 3-2 loss to the Devils, it was the eighth time in the last 28 that the Blueshirts had lost after being tied or leading in the third.

“You want to focus on not allowing teams to have time and space,” McDonagh said. “Once we got that lead, we had back pressure and stayed on our checks.”

Derek Stepan, on maintaining the lead, said: “You have to stay on your toes, if you sit back, there’s too many teams in this league who will take advantage. One of our strengths that we’ve always had is our forecheck. That’s defense, 200 feet from our net. One of the things we did a good job on was jumping on pucks, our Ds were active and we stayed aggressive.”

With the two points, the Rangers (28-18-5) held onto second place in the Metropolitan Division with 61 points. They visit Philadelphia on Saturday.

The game began with an unfortunate start for Marc Staal. Ryan Carter blocked Staal’s shot from the right point at the Wild blue line, raced down on a breakaway and beat Lundqvist (16 saves) stickside at 2:09. Staal then went off for interference at 6:08 and Matt Dumba’s one-timer from the top of the left circle went under a half-kneeling Dylan McIlrath and through a screened Lundqvist at 7:57.

“I have to step up, I have to be better [early in the game], that was my first thought,” Lundqvist said. “It’s a lot of basic routine saves, then maybe one or two scoring chances where I have to make the difference. In the first I was unable to do it, but in the third I came up with a couple.”

The Blueshirts, playing without injured Rick Nash and Kevin Klein, came out in the second transformed, first killing off the last 40 seconds of a Wild power play and then scoring twice in 1:20 to tie the score at 2.

From behind the Wild net, Derek Stepan found McDonagh in front, and the captain somehow kept the puck on his stick in traffic and slammed it through a prone Dubnyk at 3:15.

Then the red-hot Miller scored his eighth goal in eight games when he ripped Brassard’s pass through the slot to the right of Dubnyk past his far side. Shots were 8-0 in favor of the Rangers to that point, and the visitors, who were on a 1-7-1 skid, were scrambling.

When Ryan Suter went off for a high-stick at 6:01, the Rangers controlled the zone, taking four shots and the power play ended with three Wild players covering the puck in the crease.

The Rangers outshot Minnesota 17-4 in that second period.