MONTREAL (AP) Carolina kept taking the lead, only to see the Montreal Canadiens tie it up.

The Hurricanes remained resilient and found a way to come up with a victory.

Justin Williams scored the winner at 9:41 of the third period when he deflected Teuvo Teravainen's shot past Carey Price, giving Carolina a 6-5 win Thursday night. It came exactly 10 seconds after Montreal's Max Pacioretty made it 5-5 with a deflection of his own.

''Look at the character of our team,'' said Hurricanes goalie Cam Ward, who made 26 saves. ''Being able to bounce back every time we got scored on, we responded within minutes to regain the lead. That's a compliment to the players.''

Teravainen scored twice and added an assist, and Jordan Staal, Jeff Skinner and Derek Ryan and Justin Williams also had goals for the Hurricanes, who had lost their last two. Defenseman Noah Hanifin had three assists.

''We gave up four goals in the second period and still walked away with the lead,'' Ward said. ''That doesn't happen very often.''

Charles Hudon scored twice and added an assist for the Canadiens. Brendan Gallagher and Jeff Petry also scored, while Price stopped 23 of 29 shots in defeat.

''We battled hard and tied it up, but we gave them too much momentum,'' said Canadiens forward Paul Byron, who extended his point streak to six games.

It was a poor defensive showing by both teams in the final game before the NHL's break before the All-Star game.

Montreal fell behind early and tied it three times, but Carolina held on for its third straight victory against the Canadiens.

After Teravainen and Staal made it 2-0 in the first period for Carolina, the teams combined for seven goals in the middle frame, including five goals in a frantic 2:51 span.

Hudon got the goal frenzy started at 6:08 with an easy tap-in after Petry's shot from the point went off both posts and landed in Ward's crease.

Gallagher tied it 39 seconds later when he jumped on a bad giveaway by Brock McGinn in Carolina's zone.

But the game was tied for just 23 seconds.

Left all alone at the side of the net, Skinner made it 3-2 at 7:06 before Teravainen increased the Hurricanes' lead with his second of the game on the breakaway at 7:35.

Hudon settled a bouncing puck and beat Ward through traffic at 8:59 to bring Montreal within one.

On a complete defensive breakdown for Carolina, Petry skated from the blue line to the net unchallenged and fired the puck between Ward's pads to tie it at 4.

With 6 seconds remaining on the clock in the second, Ryan notched his 11th goal of the season to put the Hurricanes back on top.

''After the second period, tying the game up like that, we should have kept rolling, should have kept going,'' Byron said. ''But a couple of mental mistakes put us back in the hole again. It's tough to come back from those.''

After Pacioretty and Williams traded goals in the third, the Canadiens came close to tying it in the finals seconds, but Byron's shot rang off the post.

''I haven't seen that many mistakes in a while,'' Canadiens coach Claude Julien said. ''We didn't make good decisions individually. It's not about pointing the finger because you win as a team and you lose as a team. But I would expect our players to be ready to play a game and be focused. Some of them were, but a lot of them weren't.

''Pros have to be pros. We don't babysit. We prepare guys.''

NOTES: Montreal's Tomas Plekanec is one point away from 600 in his career. ... Sebastian Aho, Carolina's leading scorer, was out with a concussion.


Hurricanes: vs. Ottawa on Tuesday night.

Canadiens: at St. Louis on Tuesday night.

Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.