The Australians triumphed after Hungary sensationally tied the scores at 11-11 in the last second of regulation play.
The result mirrors the Beijing Games four years ago, when Australia also beat Hungary in the bronze medal match.
And like Beijing, where penalty shots were needed to decide the medal, the Australians in London had anxious moments.
With two minutes remaining in the second quarter, they were cruising with a 7-3 lead.
But with a minute to go in the third, Hungary had stormed to within a goal.
In a tense last quarter, Australia were protecting a one-goal buffer and seemingly had the game won with nine seconds left when goalkeeper Alicia McCormack saved a shot.
But in trying to run down the clock, McCormack swam away from goal under pressure from two opponents and lost control of the ball - Hungarian Dora Antal swooped to goal with one second left.
Australia's Gemma Beadsworth scored the only two goals in extra-time, giving Australia its third Olympic women's water polo medal following the Beijing bronze and gold in Sydney 2000.
The United States meet Spain in the gold medal match later Thursday.