BOSTON — William Nylander ended up with bragging rights over his good friend, David Pastrnak, and the Toronto Maple Leafs beat the Boston Bruins in a wild game.
Nylander got his first career hat trick, James van Riemsdyk scored his second of the game to break a tie with 1:36 left and the Maple Leafs snapped a three-game losing streak with a 6-5 win over the Bruins on Saturday night.
"We've got to bring Pastrnak on the road with us all the time to every rink," Toronto coach Mike Babcock said. "(Nylander) always wants to be better than 88, so we've just got to get an 88 on every team and he'll be unbelievable."
Connor Brown also scored for Toronto, which moved one point behind Boston for third place in the Atlantic Division. The Maple Leafs have played five fewer games than the Bruins.
But it was Nylander's night.
"That's definitely a night he will remember, for sure," Maple Leafs rookie Auston Matthews said. "He was all over the puck. He obviously has an unbelievable shot, a really good release and he was able to utilize it on all three goals."
Pastrnak scored two goals for Boston, and Ryan Spooner, Patrice Bergeron and Torey Krug each added one. Bergeron and Krug had power-play goals.
The Bruins rallied from a 4-1 deficit and tied it at 5 late.
"You're always disappointed when you lose a game like that," Boston coach Claude Julien said.
Frederik Andersen stopped 36 shots for the Maple Leafs.
Goaltender Tuukka Rask, playing his 12th consecutive game, was pulled after the Maple Leafs' fourth goal. Zane McIntyre made 10 saves in relief.
The Maple Leafs led 4-1 after getting three goals less than two minutes apart in the second period, but the Bruins charged back to tie it on Spooner's goal with 9:54 left in the third.
"We kept battling back, which is great, but we kept putting ourselves in a situation to do that," Bruins defenceman Adam McQuaid said. "These late goals can't happen and we just have to find ways to stop that from happening."
Brown banged home a shot from the slot to put Toronto back ahead, but Bergeron tied it again with 2:54 to play.
Van Riemsdyk scored from the right point, beating a screened McIntyre. His younger brother, Trevor, also had a late game-winning goal Saturday, helping the Chicago Blackhawks beat the Dallas Stars.
One of the loudest cheers of the night came when highlights of each of the Patriots' four Super Bowl victories were played on the Jumbotron — the biggest roar came on the clip of Malcolm Butler intercepting a pass at the goal line in 2015.
Seconds later, Toronto moved ahead 2-1 when McQuaid's bad clearing pass caromed off the boards and ended up with van Riemsdyk alone in front. He tucked a shot under Rask's pads at 8:31.
On the ensuing shift, Bruins defenceman Kevan Miller fell down at centre ice and Nylander broke in alone on a 2-on-1 rush before firing a wrist shot over Rask's left shoulder. Julien called timeout after the goal.
With McQuaid in the penalty box for holding, Nylander completed his hat trick and made it 4-1 by slipping a wrist shot into the net at 10:17.
But the Bruins rallied back.
Pastrnak's second goal came midway into the second. Krug's score sliced it to 4-3 at 15:53.
Boston had jumped in front 1-0 on Pastrnak's goal 2:17 into the game, but Toronto tied it when Nylander collected Nazem Kadri's pass, skated in alone and tucked the puck behind Rask.
NOTES: Spooner's score snapped a 16-game goal-less stretch. ... McQuaid bloodied Matt Martin's face with a couple of right-handed punches during a long fight late in the second. ... Boston scored a power-play goal for the season-high fifth straight game. ... Toronto won the previous two games against Boston this season — both by 4-1 scores. ... The clubs' final regular season meeting will be March 20 in Toronto.
Maple Leafs: Close a six-game trip at the New York Islanders on Monday.
Bruins: Host the San Jose Sharks on Thursday in the second of four straight at TD Garden.