TORONTO -- Brad Marchand scored with eight seconds left in overtime, and the Boston Bruins recovered to defeat the Toronto Maple Leafs 4-3 at Scotiabank Arena on Saturday.

After Joseph Woll stopped David Pastrnak on a breakaway, Pastrnak got the rebound and passed to Marchand, who gloved the puck down and shot into an empty net with Woll out of position.

"Marchand created an amazing turnover and I had a quick look if he was coming," Pastrnak said. "It looked like he didn't want to go, so I tried a breakaway and didn't get it in. I saw him stop at the net, so I just tried to get it as quick as possible to him. A great handle by him, so I'm so happy for him, a big goal for him.

"I knew the goalie was coming back (into the net), so I honestly just shot it at Marchand and hoped he was going to handle it, which he did."

BOS@TOR: Pastrnak sets up Marchand's overtime winner

Pastrnak had a goal and two assists, and Linus Ullmark made 37 saves for the Bruins (16-4-3), who had lost three in a row prior to a 3-0 win against the San Jose Sharks on Thursday.

"This was the best game we've played in a while, maybe two weeks," Boston coach Jim Montgomery said. "Sometimes you need to face some hard times to realize it's not always going to come easy. How hard we were to play against, time and space, protecting the middle of the ice and I loved [Pastrnak] tonight."

Auston Matthews scored twice for the Maple Leafs (12-6-4), including the tying goal with six seconds left in the third period. Woll made 33 saves for Toronto, which is 6-1-2 in its past nine.

Matthews tied it 3-3 when he one-timed a pass from Mitchell Marner at the right face-off dot.

BOS@TOR: Matthew scores his second goal of game

Trent Frederic put the Bruins up 3-2 at 13:10 of the third when he jammed in a loose puck at the top of the goal crease after Woll mishandled a shot from Derek Forbort.

The Bruins went up 1-0 at 10:44 of the first period when Pastrnak scored from the top of the right circle.

Kevin Shattenkirk scored his first goal with the Bruins to make it 2-0 at 7:31 of the second period when he took a pass in the slot from Pastrnak, who was at the top of the left circle, and put a backhand shot over Woll's glove.

"[It felt] great," said Shattenkirk, who signed a one-year contract with Boston on July 1. "I think that's kind of something everyone is probably waiting to do when they join a new team. To contribute, for me that's part of my game, so I'm happy it was a meaningful goal tonight and we were obviously able to stick it out and win in overtime."

Matthews cut it to 2-1 at 12:06, scoring on a rebound off William Nylander's shot that hit the post with Ullmark out of position. It was his first goal in five games.

"I thought we were just hunting pucks really well, turning them over, attacking," Matthews said. "I thought we had more of an attack mentality tonight instead of trying to make the extra play and I think it paid off. We had a lot of really good shifts."

Max Domi tied it 2-2 at 2:11 of the third period when he took a pass from Nicholas Robertson and deked Ullmark with a backhand. It was his first goal with Toronto.

"It feels good to contribute, but that [stuff] is irrelevant when you don't win," Domi said. "Obviously you want to come away with two points there, but the boys battled back and showed a lot of character against a real good team, a well-coached team. They're a heck of a hockey club for a reason. A good test, but I think our group showed what we are capable of, and if we find a way to string 60 minutes together like that, we'll be a tough team to beat as well."

NOTES: Pastrnak had a game-high 10 shots on goal. He scored the 66th game-opening goal of his NHL career, passing Phil Esposito (65) for the fourth-most in Bruins history. He trails Patrice Bergeron (89), Johnny Bucyk (85), and Marchand (75). … It was the 18th overtime goal for Marchand, the fourth most in NHL history, behind Alex Ovechkin (25), Sidney Crosby (20) and Jaromir Jagr (19). … Maple Leafs forward Noah Gregor had one shot on goal in 9:58 of ice time in his 200th NHL game. ... The Bruins won their fifth straight game against the Maple Leafs.