Australia snatched the lead against the run of play through Alanna Kennedy’s brilliant header in the 35th minute, then fell behind to two Ellen White goals before Sam Kerr struck in the 89th minute to send the game to 120 minutes.
Mary Fowler’s dramatic strike in the 103rd minute put the Australians in front – barely a minute after the brilliant Teagan Micah saved a penalty – before Kerr sealed the deal with a header in the 106th.
White completed her hat-trick in the 115th minute but the Matildas held on, becoming the first Australian football team to reach the Olympics final four.
Great Britain dominated most of the opening half and should have taken the lead, bar Micah’s goalkeeping masterclass.
In the 15th minute, Keira Walsh smacked the post from long-range, while in the 24th, Lauren Hemp’s close-range shot forced a brilliant Micah save.
Eleven minutes later, Australia snatched the lead.
Steph Catley looped a corner into the box, with Kennedy making light work of the much-shorter Demi Stokes to nod home a towering header.
Great Britain hit back against the run of play in the 57th minute, when Hemp’s delightful cross dropped perfectly between Kennedy and Ellie Carpenter, for White to head home.
Nine minutes later, Aivi Luik and Kennedy got in each other’s way and were unable to clear the ball and it fell to White, who powered her second past a helpless Micah.
Then the Matildas hit back.
Emily van Egmond looped a searching long ball into the 18-yard box and Kennedy flicked a header on to Kerr, who took a touch, let the ball settle then rifled it past the scattered British defence to send the game to 120 minutes.
Micah denied Walsh’s scintillating shot in the 94th minute, then batted away White’s close-range effort.
But her biggest moment came in the 102nd when Ellie Carpenter gave away an arguably soft penalty against Nikita Parris.
Caroline Weir’s spot-kick was poor and a commanding Micah palmed it away.
Less than 90 seconds later, teen sensation Fowler tried her luck on her left from distance.
The shot took a heavy deflection off Great Britain superstar Lucy Bronze and nestled in the top corner.
Three minutes later, Kerr leapt over Houghton to double Australia’s lead – before White’s late header forced the Matildas to grit their teeth and hang on for a famous victory.