NEW YORK -- Playing for the first time in nearly a week, the Toronto Maple Leafs showed no signs of rust and kept up their strong play.

William Nylander and James van Riemsdyk scored in the first period, Frederik Andersen stopped 34 shots and the Maple Leafs beat the New York Rangers 4-2 on Friday night. Connor Brown and Connor Carrick also scored as Toronto won for the seventh time in nine games (7-1-1).

"It's huge," Brown said of the win. "It's nice that they had the exact same break as us. There was no advantage either way. It was nice we were all well rested. After a couple days off, you get excited to come back to the rink. We were ready to play today."

Tyler Bozak and Mitch Marner had two assists each as the Maple Leafs moved four points behind Philadelphia for the second wild card in the Eastern Conference. Toronto, which came in sixth in the league on the power play at 22 per cent, was 2 for 4 and held the Rangers to 0 for 6.

"I thought we were good," Maple Leafs coach Mike Babcock said. "Obviously, we took way too many penalties, so it threw some rhythm off our bench. ... Our penalty kill was really good."

Chris Kreider and J.T. Miller scored for the Rangers, and Henrik Lundqvist finished with 23 saves. New York, coming off a 5-4 win at Columbus last Saturday, lost for the second time in seven games.

"I think we've got to, coming off a break like that, play a smarter game, be smart in our positioning, smart in our reads," Rangers captain Ryan McDonagh said. "I think we got a little ahead of ourselves. ... We wanted to get going on the offensive side and we didn't stabilize the puck when we probably should have early on, to get a feel for the game and get a feel for the puck and our legs."

Trailing 3-1 after two periods, the Rangers pressed in the third, outshooting the Maple Leafs 14-7.

However, Carrick gave the Maple Leafs a 4-1 lead with 6:40 left, knocking in the rebound of a shot by Bozak on a power play for his second of the season.

Brown liked the way his team played with the lead in the third period.

"I think we can still be better, but we kept the pedal down and tried to go get the next one and that's what we did," he said. "The biggest thing is you have to continue to make plays, especially in our own end ... and we did a good job of that tonight."

Miller pulled the Rangers within two again, scoring his 13th off a pass from Pavel Buchnevich with 1:25 remaining.

Kreider gave New York a 2-1 lead at 9:05 of the second. During a scramble in front of Toronto's goal, Kreider was down on the ice as he tried to swipe the puck in from the right side. The attempt was stopped by Andersen, but the puck came back to Kreider, who turned and was still down on one knee as he backhanded it in for his team-leading 17th.

Brown restored the Maple Leafs' two-goal lead as he fired a long shot from beyond the left faceoff circle that deflected in off the back end of McDonagh's stick. It was Brown's 10th goal and gave rookie Auston Mathews his team-leading 36th point.

"I feel like the big killer this game was the third goal," Lundqvist said. "I felt like we turned it around a little when we scored our first goal. We had momentum a little bit. Then we get a bad bounce there and that was a tough one. The energy kind of went down a little bit after that."

Nylander, whose father Michael played for the Rangers from 2005-07, got Toronto on the scoreboard 4:49 into the game, with a shot from the right faceoff dot through Lundqivst's five-hole for his ninth.

The Maple Leafs made it 2-0 with 2:32 left in the opening period. On a power play, van Riemsdyk got a pass from Marner in front, moved the puck to his left and sent it past Lundqvist down on his knees for his 15th.

NOTES: The Rangers honoured former New York police detective Steven McDonald, who was paralyzed after being shot in 1986 and passed away earlier this week. His funeral was earlier Friday and his widow, Patti, and son Conor, an NYPD sergeant, were joined on the ice before the game by former Rangers greats Mark Messier and Adam Graves for the ceremonial puck drop. McDonald was also honoured with a video tribute about eight minutes into the game. ... The teams play two more times -- both at Toronto -- next Thursday and Feb. 23. ... LW Rick Nash and LW Buchnevich were back in the Rangers' lineup. Nash (groin injury) missed eight games and Buchnevich (back injury) played for the first time since Nov. 12. Buchnevich had a goal and an assist in three games for Hartford of the AHL before being called up on Thursday.

UP NEXT

Maple Leafs: At Ottawa on Saturday night before returning to Toronto for a four-game homestand.

Rangers: At Montreal on Saturday night.