Corey Perry and Tyler Toffoli also scored and Carey Price made 41 saves in front of the first Canadian hockey crowd since the start of the pandemic.
With his team outshot 13-2 and struggling to generate anything in the extra period, Kotkaniemi ripped a shot past Jack Campbell's glove side after Toronto defenseman Travis Dermott turned the puck over to Paul Byron.
''It's pretty unbelievable,'' said the 20-year-old Kotkaniemi, who was a healthy scratch in Game 1. ''Remarkable ... it's a great feeling. Especially when the fans are in the stands. Gives you goosebumps.''
Jason Spezza and T.J. Brodie scored for Toronto, beating Price with under 10 minutes to go in regulation to tie it. Campbell stopped 28 shots.
''The crowd and the push at the start was significant for them,'' Maple Leafs coach Sheldon Keefe said. ''We've got to be a whole lot better.''
Game 7 is Monday night in Toronto, with the winner facing Winnipeg. Also an overtime winner in Game 5 in Toronto, the Canadiens are looking to come back from a 3-1 series deficit to win for the third time in franchise history.
''There's no quit in this group,'' said Montreal captain Shea Weber, who played more than 37 minutes. ''We grinded. (Price) kept us in it, especially in overtime there when they were pushing and gave us a chance.''
Montreal won despite being outshot 13-2 in overtime.
''That's just hockey,'' Toffoli said. ''You just have to find a way. One shot wins it. We just found a way.''
About 2,500 fans were allowed in the 21,302-seat arena after the Quebec government relaxed some restrictions and the province's curfew ended Friday.
''We could hear them before the game and, going out for warmups, had chills,'' Weber said. ''Honestly, it was unbelievable. It felt like a lot more than 2,500 people. It was amazing. I can't imagine what 20,000 people would be like.
''That was electric.''
Perry opened the scoring at 5:26 of the third period on a scramble in front with Toronto's William Nylander off for goalie interference.
Toronto coach Sheldon Keefe's challenge was denied, putting the Maple Leafs back down a man. Mitch Marner then fired a clearing attempt over the glass to gift the home side a 5-on-3 power play for 1:41.
And the Canadiens made the Maple Leafs pay when Toffoli squeezed a shot past Campbell at 6:43 to stretch the lead to 2-0.
Spezza cut it to one with 8:25 left when his shot went in off the stick of Montreal defenseman Jeff Petry. Brodie tied it off Petry's skate with 3:11 left.
''We just didn't come ready to play,'' Marner said. ''We really do have to start on time because it's getting said a lot, and it's not good enough.''
More AP NHL: https://apnews.com/hub/NHL and https://twitter.com/AP-Sports
Copyright 2022 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.