BUFFALO, N.Y. (AP)Josh Anderson scored with just under four minutes remaining, leading the Montreal Canadiens to a 3-2 win over the Buffalo Sabres on Thursday night.

Brendan Gallagher and Kaiden Guhle also scored for the Canadiens. Sam Montembeault made 43 saves.

”I’m happy with the result,” Montreal coach Martin St. Louis said. ”It’s rare you play a perfect game. We had some highs and some lows, but we found a way.”

Anderson scored the winner with 3:46 left. Following a flurry of activity in front of the Buffalo net and a highlight-reel save by Sabres goalie Eric Comrie, the puck found its way back to Anderson, who scored on a long shot.

”I was just looking at an empty net and obviously their goalie made a nice save,” Anderson said. ”You kind of just have to stay with it and finish the shift out and lucky Savvy had the puck there and saw me open and I was fortunate enough to get it off and squeak one in there at the end.”

Dylan Cozens and Jeff Skinner scored for Buffalo. Comrie finished with 31 saves.

”I think the second period was our big, big opportunity,” Sabres coach Don Granato said. ”I think there we complicated some things. We could have been a little bit more intense going to the net. We tried to pass the puck into the net. Feeling good about puck movement of possession time and didn’t have the killer instinct that we needed at that point, and it caught up with us.”

Cozens evened the score a 2 with 7:06 left in regulation, firing a wrist shot through traffic and screens for his third goal in four games.

Guhle gave Montreal a 2-1 lead just under seven minutes into the third period with a one-timer from the middle of the right circle.

The Canadiens opened the scoring on a fortunate bounce with 6:29 remaining in the first period. Gallagher’s shot from the right circle was stopped by Comrie, but the rebound deflected off Owen Power’s skate into the net.

Skinner evened the score 31 seconds into the second period on a terrific individual effort. The winger maneuvered through the right circle and forced Montembeault to commit before scoring his first goal of the season with a high shot to the glove side.

With injuries on defense heading into the game, the Sabres paired two former first overall picks together for the first time. Owen Power, the first pick in the 2021 draft, joined standout Rasmus Dahlin, the first pick in the 2018 draft, as the Sabres’ top defensive pairing.

NOTES

Sabres GM Kevyn Adams said Thursday morning that defenseman Mattias Samuelsson will miss a few weeks with a knee injury. That came as good news for the Sabres, who initially feared that Samuelsson could be out for much longer. Samuelsson was injured Saturday against Vancouver. … Buffalo defenseman Henri Jokiharju is considered week to week with a facial fracture after taking a puck to the face against Calgary on Oct. 20. … Montreal winger Juraj Slafkovsky remained out with an upper-body injury, but is with the team for its current trip. Slafkovsky was the No. 1 overall pick in this year’s draft.

UP NEXT

Montreal: At St. Louis on Saturday in second game of a four-game trip.

Buffalo: Host Chicago on Saturday in second game of a four-game homestand.

More AP NHL: https://apnews.com/hub/nhl and https://twitter.com/AP-Sports