Diana Matheson scored a last-gasp goal to earn Canada the Olympic bronze medal at the expense of France with a 1-0 win.
Matheson made no mistake from close range after Sophie Schmidt's shot had deflected into her path although Kaylyn Kyle appeared to be in an offside position.
It was hard luck on France who had dominated the second half but they were to rue a series of missed chances and fine saves from Canadian keeper Erin McLeod.
Canada were the more threatening in the opening 45 minutes and six-goal Christine Sinclair was only just too high with a rising drive.
Melissa Tancredi then headed wide after French keeper Sarah Bouhaddi had collided with her own defender Laura Georges.
Tancredi also failed to make proper contact contact on a volley when well placed.
But the best chance of the half fell to France when Elodie Thomis broke clear down the right and had her shot smothered by McLeod.
It needed a fine save by McLeod early in the second period to keep Canada on level terms.
Louisa Necib's shot took a deflection off Carmelina Moscato and wrong-footed McLeod but she was able to adjust and make a one-handed stop away to her left.
France dominated after the interval and a low shot from Gaetane Thiney struck the post from Thomis's cross.
The woodwork again came to Canada's rescue when Thomis ran onto a knockdown from substitute Eugenie le Sommer and hit the bar.
Le Sommer shot over from close range and Corine Franco's goal-bound shot was blocked by Desiree Scott.
McLeod again covered herself in glory by finger-tipping away Franco's close-range effort as the game appeared to be heading for extra-time.
But with only seconds remaining Matheson broke the deadlock.