Roman Polak scored late in the second period and James van Riemsdyk and Nikita Soshnikov had goals in the third to give Toronto a comfortable cushion.
The Maple Leafs moved a point ahead of Boston in the Atlantic standings and into third place for the division's third guaranteed spot in the playoffs. Toronto has played five fewer games than the Bruins, putting it in a relatively favorable position to make the playoffs for the first time since 2013 and just the second time in 12 seasons.
Petr Mrazek stopped 24 shots for the Red Wings.
Detroit had earned a point in the previous six games, tying a season high, but its previous three games were lost in overtime.
Matthews' 23rd goal added to his highlight reel from his rookie season 5:30 into the game. After Detroit defenseman Jonathan Ericsson lost control of the puck in front of Mrazek, Matthews tapped the puck from behind Detroit defenseman Xavier Ouellet and through his legs. Matthews kicked the puck into shooting position with his right skate, then lifted a backhander into the net.
Playing in his 600th game, Polak made a savvy play to put Toronto up 2-0. He shot wide of the net and the puck went off Ericsson's right leg and past Mrazek.
Soshnikov and van Riemsdyk scored what appeared to be soft goals, beating Mrazek with shots that he seemed capable of stopping to keep it a two-goal game. Even if Mrazek did make those saves, however, the Red Wings failed to generate much offense at the other end of the rink.
The Maple Leafs were so dominant at times that it looked as if they were on a power play in even-strength situations. While killing a penalty in the first period, they swarmed around Detroit's players with the puck so well that they couldn't get a shot off even with an extra skater. When Detroit had a man advantage in the second period, it had as many shots (one) as Toronto did during the two-minute stretch that included Mrazek stopping Leo Komarov's scoring chance.
NOTES: Andersen, acquired in a trade from Anaheim last summer, matched his career high with his third shutout. He had three shutouts in each of the previous two seasons with the Ducks while splitting starts with John Gibson. ... Detroit F Thomas Vanek returned from a one-game absence because of a lower-body injury. ... Matthews was in Ann Arbor, Michigan, as part of the National Team Development Program from 2013 to 2015 before playing professionally in Switzerland last season. He joined Patrick Kane, Erik Johnson and Rick DiPietro as players who were in the USA Hockey program and went on to be No. 1 picks overall in the NHL draft. ... The Red Wings had won their previous three home games against Boston, Montreal and Pittsburgh. ... Toronto D Morgan Rielly missed his fourth straight game with a lower-body injury.
Maple Leafs: Play Thursday night on the road against the Philadelphia Flyers, hoping to improve its 2-7-1 record in the second game when playing on consecutive days.
Red Wings: After All-Star break, host New Jersey on Tuesday night to begin a desperate push to rally in the standings to earn a 26th straight postseason appearance.