After scoring his first career hat trick, Joel Armia was more concerned with the Montreal Canadiens getting another win.

Armia had three goals and the Canadiens beat the New York Rangers 4-2 on Friday night for their fourth victory in six games.

"It feels good," Armia said, "but I think for our group it doesn't matter who scores the goals right now. We just need to get wins. ... The most important thing for us is just to finish real well and get some momentum going into the next game."

Brendan Gallagher also scored and Carey Price stopped 28 shots. The Canadiens, who hold the first wild-card spot in the Eastern Conference playoff race, pulled five points behind Toronto for third place in the Atlantic Division.

Vladislav Namestnikov and Brendan Lemieux scored, and Henrik Lundqvist finished with 32 saves as the Rangers lost their third straight and fourth in five games (1-2-2). Brady Skjei had two assists.

Armia pushed Montreal's lead to 3-1 when he brought the puck up the right side and beat Lundqvist with a wrist shot 4:29 into the third period.

Lemieux, playing his second game with the Rangers since arriving from Winnipeg in a trade for Kevin Hayes, pulled them within one when Skjei's pass went off Jesper Fast's skate and Lemieux's stick with 2:32 to go. It was his 10th of the season and first with New York.

Armia got his 10th to complete his first career hat trick on an empty-netter with 36.7 seconds to go.

He acknowledged he was thinking about the hat trick after he scored his second goal of the night.

"I knew if I get out there and have a chance, I'm going to bury it," said Armia, who couldn't remember if he had ever scored three goals in a game at any level.

Montreal coach Claude Julien credited Price for helping keep the team close until it got going in the second period.

"He made some big saves," Julien said. "We had a slow start, didn't think we were very good in the first period. They came out strong. ... Carey kept us in and gave us some big saves. Even in the second period, (he) made some huge saves and eventually we managed to score some goals."

Trailing 1-0 after the first, the Canadiens went ahead with two goals in the middle period while sending 18 shots at Lundqvist.

Gallagher tied the score with his 28th, deflecting a centring pass from Tomas Tatar up high over Lundqvist's shoulder at 7:27. Gallagher has five goals in his last five games.

The Canadiens took the lead with the help of a fortuitous bounce with 5:22 left in the period. Montreal defenceman Christian Folin sent a dump-in pass from the left side that rebounded off the end boards. Lundqvist got a piece of the puck, but it came out in front and Armia knocked it in before the diving goalie could stop it.

"It's a tough bounce, obviously," Lundqvist said. "We played a good game leading up maybe to their first goal, and then that put us on our heels a little bit. And the second goal didn't help our game there. ... It changed the momentum."

Tatar nearly added to the lead, but Lundqvist turned away his breakaway attempt with 3 1/2 minutes to go in the second.

"As the game progressed, we got better," Price said. "It's a game of momentum."

The Canadiens outshot the Rangers 11-9 in the first but trailed after 20 minutes.

Namestnikov got the Rangers on the board, deflecting a pass from Skjei past Price for his ninth 4:41 into the game. Namestnikov has five goals and eight points in the last eight games.

Namestnikov also had several other scoring chances in the first period but was denied on an attempt in front with less than seven minutes remaining and then again about four minutes later. Price also stopped his wraparound try in the final minute.

NOTES: Gallagher has eight goals and 11 points in his last 12 games. ... Armia had his second multigoal game of the season. The other was at Columbus on Jan. 18. ... The Canadiens took two of three in the season series, also winning 5-2 at home on Dec. 1. The Rangers won the first meeting, 5-3 at Madison Square Garden on Nov. 6. ... Libor Hajek made his NHL debut for the Rangers one day after being called up from Hartford of the AHL. The 21-year-old defenceman, acquired with Namestnikov from Tampa Bay at last season's trade deadline in the deal that sent D Ryan McDonagh and forward J.T. Miller to the Lightning, had five assists and 36 penalty minutes in 58 games with the Wolf Pack. Hajek was paired with Neal Pionk. ... New York D Brendan Smith played right wing on a line with C Boo Nieves and LW Connor Brickley to start the game.