Pontus Holmberg made it 2-0 at 9:55 of the second period, taking a pass from Marner out of the corner for a wrist shot from the slot.
Nylander extended it to 3-0 at 10:50 with a one-timer from the slot off a pass from Matthews.
The goal was Nylander's 149th in the NHL, passing Hall of Fame defenseman Borje Salming for 30th in Maple Leafs history. Salming, who was from Sweden and played 1,099 games for Toronto, died on Thursday following a short battle with amyotrophic lateral sclerosis.
Rakell cut it to 3-1 with a wrist shot near the right post at 11:38 of the third period.
Matthews made it 4-1 at 14:36 with a spinning shot from the slot off a pass from Michael Bunting, who made the play from his side after falling to the ice.
"It's a good team over there, obviously. They've been playing really well lately," Matthews said. "So I think we knew it was going to be a pretty big challenge for us tonight. … Limited their best guys. Try to limit them. Obviously, they're going to get their looks, they're too good not to, but I just thought (our) all-around game was just really solid."
NOTES:Marner extended his road point streak to eight games (four goals, six assists), tying an NHL career high he set in 2021-22. … Matthews has 200 even-strength goals, becoming the seventh player in Toronto history to reach the mark. It is also tied with Alex Ovechkin of the Washington Capitals for the most in the NHL since Matthews' made his debut in 2015-16. ... DeSmith started for the first time since being evaluated for an upper-body injury after making 29 saves in a 5-3 win against the Chicago Blackhawks on Sunday.