MONTREAL — It was only a matter of time before the relentless Pittsburgh Penguins broke through Montreal's defences for good.

Montreal kept the Penguins at bay for two periods but couldn't hold them off in the third, as Pittsburgh defeated the Canadiens 5-3 on Thursday. The game was tied 3-3 going into the final frame.

"Line after line they come at you," said Brendan Gallagher, who had an assist in the first period. "You make a mistake and you spend a couple of minutes in your own zone. That wears you down as the game goes on.

"We're disappointed with the result but we were playing one of the best teams in the league. You can see why. It was a struggle for us tonight to create offence."

Pittsburgh got better as the game progressed, making a game-winner seem almost inevitable. They outshot Montreal 18-4 in the second, 10-7 in the third and 39-20 overall.

Patric Hornqvist put the Pens in front for good with 7:36 remaining in the contest by deflecting a Carl Hagelin shot past Antti Niemi. Bryan Rust added some insurance with an empty-net goal with 1:53 left on the clock.

"Give them credit. They shut us down for the latter part of the game and eventually took it over," said Canadiens coach Claude Julien. "They're Stanley Cup champions for a reason.

"As the game went on, we got worse offensively. When they get scoring chances, they score. They shot from everywhere tonight."

It looked like the Canadiens (26-33-12) had a potential upset on their hands just minutes into the first period.

Montreal jumped ahead to a two-goal lead early in the first with scores from Artturi Lehkonen and Paul Byron.

Lehkonen made it 1-0 when he deflected Jeff Petry's shot past Tristan Jarry at 3:13, his fourth goal in as many games.

Byron doubled the lead at 6:31, on the power play, when he jumped on Gallagher's rebound in the crease for his 17th goal of the season.

The Penguins (41-26-5) had two shots on net at that point, but the deficit seemed to act as a wake-up call.

"We can't sit back on our leads," said Nicolas Deslauriers, who scored Montreal's third of the game. "We know they have probably one of the best scoring touches in the lead. We had to play more in their defensive zone and make them work."

Phil Kessel got the visitors on the board at 10:05 of the first on a 2-on-1 with Rust after a giveaway by Petry in his own zone.

Hornqvist tied the game at 2-2 when his centring pass to Hagelin in front of goal went off Byron's stick and trickled past his own goalie.

Evgeni Malkin gave the Pens a 3-2 lead at 10:30 of the second with a one-timer from the faceoff dot while playing with the man advantage. Sidney Crosby got an assist on Malkin's goal and is now one pass away from 700 in his career.

"It wasn't looking good early but we stuck with it," said Crosby. "We generated some really good chances in this game. Second half of the first and the rest of the game, we played with more urgency and desperation and the result took care of itself."

Montreal equalized when Deslauriers found himself all alone in the slot two minutes later. The 27-year-old beat Jarry top shelf for his eighth of the year after blown coverage by the Penguins.

Jarry made 17 saves for his 14th win of the season while starter Matt Murray remains sidelined with a concussion.

Pittsburgh remain tied on points atop the Metropolitan Division with the Washington Capitals. The Caps also won on Thursday.

Habs goalie Antti Niemi stopped 34-of-38 shots in his first regulation loss since Feb. 14.