France completely dominated the second half and had several chances to score. But Matheson latched on to a loose ball in the second minute of added time and was unmarked when she volleyed the ball past France goalkeeper Sarah Bouhaddi.
In the build-up, Matheson played a pass inside the penalty area to midfielder Sophie Schmidt, who turned, dribbled and fired a shot. It deflected off France defender Sonia Bompastor and the ball landed at the feet of Matheson, who slotted it home.
"It feels amazing," Matheson said about her goal. "It feels unreal, it feels like a dream. We felt as a group that we were going to earn this and we did, in the last minute."
It is Canada's first Summer Games medal in a traditional team sport since 1936, when the men's basketball team won a silver, according to the Canadian Press news agency.
After a timid first half, France overran Canada in the second interval. Forward Gaetane Thiney hit the post in the 62nd minute after right winger Elodie Thomis ran to the byline and crossed the ball across the face of goal, and Thomis then struck the crossbar two minutes later.
Defender Corine Franco's close-range effort was cleared off the line by Canada midfielder Desiree Scott in the 71st. Those were just a sample of the barrage faced by Canada, who appeared to have heavy legs after losing 4-3 in extra time to the United States in the semifinals Monday.
"I'm not absolutely sure if somebody didn't put a force field behind our goal," Canada coach John Herdman said. "The French hit the post, hit the bar, Desiree cleared one off the line, but it tells you something about these girls. All credit to them."
Canada captain Christine Sinclair's hat trick against the Americans was among her six goals in the tournament, but on Thursday she did little to threaten France's goal and was forced to track back to defend in the latter stages. She nearly scored her seventh goal in the 15th minute after receiving a pass on the edge of the area from right back Rhian Wilkinson. Sinclair turned, dribbled a couple of steps and fired a shot just over the bar.
"We knew it was going to be a real test today, but I think once we realized we had a little bit more gas in the tank, we went for it," Canada goalkeeper Erin McLeod said. "And I'm so proud of everyone and how they fought for the result."
France caused problems on the flanks in the first half, with right winger Elodie Thomis sending dangerous balls into the penalty area. But Canada's back line was solid and smothered the chances.
"You know sometimes you can give everything and then in the end it is not enough to win," France coach Bruno Bini said. "It is like a love story, you can give a lot, but you get nothing."
FIFA, meanwhile, is investigating "incidents that occurred" following Canada's semifinal loss to the U.S. Canada players, including Sinclair, were openly critical of the Norwegian match referee.