The USA were out of the blocks first and Rhian Wilkinson made a vital block for Canada on a Bethan Lloyd first time shot. Canada were awarded a free kick which went right across the six-yard box, with Jonelle Filigno almost getting a touch.
Some terrific passing produced the first goal in the 22nd minute for Canada, Marie-Eve Nault fed the ball through to Melissa Tancredi, who laid the ball of superbly for Christine Sinclair, who sidestepped a defender to confidently finish past Hope Solo.
Megan Rapinoe whipped a free kick in which Alex Morgan headed narrowly wide of the far post. Morgan then was the source for an Abby Wambach header which just went the wrong side of the post.
Early in the second half, Wambach controlled the ball on her chest and volleyed over the top as the USA again started strongly. On 54 minutes the game was tied, Rapinoe's low corner to the near post went straight in, with the upright unguarded.
The Canucks were back in front on 67 minutes, as Tancredi turned the full back and delivered the perfect cross for Sinclair to head home convincingly.
The drama soon switched to the other end, as on 70 minutes Rapinoe drove the Americans back on level terms from the edge of the area, in off the far post.
Canada were not to be held back though, a 73rd minute corner was again met by the head of Sinclair and incredibly it was now 3-2.
A penalty was given to the USA, a harshly handball decision against Nault from Rapinoe's indirect free kick in the box and Wambach stepped up to level via the upright with 11 minutes to play.
Morgan got away and crossed for Wambach, who was just unable to turn the ball inside the post from close range.
Sophie Schmidt got into the box in the last minute but Solo blocked the shot from a tight angle.
Into the first period of extra-time and a Tancredi overhead kick was caught by Solo, Sydney Leroux fired over the Canucks bar and Erin McLeod got down to save a Wambach header.
Diana Matheson was brought down just outside the American box but the free kick cleared everyone. Matheson was in again and Rachel Buehler made a vital tackle as Tancredi pulled the trigger. The period ended with McLeod fortunate to be awarded a free kick when misjudging a high ball.
Desiree Scott suffered an awful looking knee injury, seconds after Schmidt was caught by Wambach but amazingly went straight back on.
Heather O'Reilly was inches away from turning Morgan's cross in, defenders doubled up to block Wambach, who shortly afterwards headed against the bar.
The most entertaining of games ended in the most dramatic of ways, as with 30 seconds of stoppage time left, O'Reilly's cross was headed into the roof of the net by Morgan to give the Americans a 4-3 lead.
So, USA versus Japan for gold on Friday, Canada and France are left to chase bronze.
Canada: McLeod, Moscato, Wilkinson, Matheson, Sesselmann, Scott, Sinclair, Schmidt, Tancredi, Filigno (Kyle, 67), Nault (Stewart, 101)
Unused Subs - LeBlanc, Chapman, Parker, Timko, Booth.
USA: Solo, Rampone, O'Hara, LePeilbet (Leroux, 76), Lloyd, Cheney (O'Reilly, 101), Morgan, Wambach, Rapinoe, Buehler (Sauerbrunn, 110), Heath
Unused Subs - Mitts, Boxx, Rodriguez, Barnhart
She Kicks - the online news service for women's football