The Toronto Maple Leafs got a scare in a 2-1 win over the Montreal Canadiens on Thursday night when star forward William Nylander left the game midway through the first period after taking a knock to the head.

He was held out for the rest of the game for what the team called “precautionary reasons.” Maple Leafs head coach Craig Berube said Nylander avoided serious injury and would be OK.

“Willy will be fine,” said Berube. “Nothing to worry about.”

The Maple Leafs controlled the play in the first two periods before the Canadiens battled back in the third.

“We had a lot of young players and I wouldn’t say they were intimidated, but maybe they needed a period to say, ‘OK, we’re in Toronto against the big club,’” said Canadiens head coach Martin St-Louis. “I liked how they calmed down and started playing.”

“The guys fought. The effort was there, the commitment, the collective intentions. The guys worked hard,” he added.

Jakub Dobes made 32 saves for Montreal, including 27 in the first 40 minutes of play.

“He played really well,” St-Louis said of the 23-year-old Czech. “He gave us a chance to calm down, to breathe.”

Dobes said he feels more mature than he did at this time last year, when he was preparing to play his first season in the professional ranks.

“You can have a good game, but tomorrow someone is still coming for your spot,” he said. “Tomorrow I need to be ready again and show the coaches, whoever that I belong here.”

Dvorak scored the only goal for the Canadiens, who had won their first two preseason games by shutout.

Defenceman Lane Hutson again made some nice moves in the offensive zone. Up front, Oliver Kapanen was a little more visible than Owen Beck, who was quiet. Luke Tuch also pestered the Leafs with his physicality.

John Tavares was the other goal scorer for the Maple Leafs. Anthony Stolarz allowed one goal on 10 shots in the first two periods. Matt Murray then stopped seven shots in the third period.

Tavares appeared to injure his leg in the first period when he was hit by Michael Pezzetta. After remaining in the game, he had only two shifts in the third period.

Although the Maple Leafs took control of the game early, it was the Canadiens who had the first good scoring chance when Joshua Roy hit the crossbar.

The Maple Leafs then threatened on the penalty kill. Dobes was alert against Chris Tanev and then Pontus Holmberg, each time on set-ups by Mitch Marner.

Tavares opened the scoring on another nice pass from Marner, this time on the power play at 10:12 of the first period. Posted at the mouth of the net, Tavares was overlooked by defencemen Jayden Struble and David Reinbacher and he only had to deflect Marner’s pass into the opening.

Dobes made another nice save late in the first period, when he stuck out his glove to grab a point-blank shot from Easton Cowan.

Robertson beat the Czech goalie early after the intermission, but his backhand shot hit the post.

Struble generated two chances for the Canadiens on the same sequence, but his teammates were unable to complete the plays.

Dvorak finally tied the game 1-1 at 5:43. Alex Barré-Boulet took advantage of an errant pass to retrieve the puck high in the Maple Leafs’ zone. He found Dvorak, who got alone in front of Stolarz and beat the Maple Leafs goalie between the pads.

Dobes kept the Canadiens in the game for several minutes with several saves, including two spectacular right-pad saves against Simon Benoit and Bobby McMann.

He was helpless with 1:56 left in the second period, however, when Robertson got alone in front of him after stealing the puck from Adam Engström.

“Heck of a play,” said Maple Leafs forward Steven Lorenz. “That’s just hard work, not giving up on a play. And it shows a maturity for a young guy like him. Coming on the backcheck and stripping the guy, going in and on the first three strides getting some separation and getting a great shot on the guy’s five hole.

“I get tired just watching him. He’s a good little player.”

Hutson grazed the post with just under six minutes left in the third period. Murray then got his act together at Engström’s expense after a nice pass from Beck.

The Canadiens were unable to get organized, however, after replacing Dobes with an extra attacker.

The Maple Leafs outshot the Canadiens 33-17.

“There were better sides to our game,” Tavares said. “The way we played, all three zones, we were a little more connected. The pace of our game was better. Moving the puck better.

“I liked the way that we were getting in on the forecheck.”

The pre-game hype was around 35-year-old Max Pacioretty in his first game as a Leaf against the team he once captained. Though there were a few of his old Montreal sweaters in the audience, the visiting fans made their feelings known about him leaving for the Vegas Golden Knights, booing him every time he touched the puck.

“It was definitely weird going back there at the beginning and getting booed by some fans then playing in the playoffs,” Pacioretty said Thursday morning. “I think it’s a cool rivalry though. I remember playing (Toronto) opening night and setting the tone to the season, good or bad.

“I haven’t played in a rivalry like this definitely since I’ve been gone from Montreal. The history of both teams, it’s such an honour, so that side of it doesn’t feel weird at all.

“I go back every summer, all my friends are there, I love the city, loved my time there, grew up there and started my family” he said, adding “not many guys are left on the team since I was there.”

Pacioretty, who scored twice in the exhibition opener against the Ottawa Senators, almost had a deflection goal in the first period and had the last of the Leafs’ 13 shots.

The Maple Leafs and Canadiens will face each other again on Saturday at the Bell Centre.

Postmedia News contributed to this report.