Francesco Totti came off the bench to score an injury-time penalty and put 10-man Italy into the quarter-finals.
Totti celebrates after snatching a dramatic last-gasp win for Italy
With the clock ticking down, Fabio Grosso marauded down the left flank and worked his way into the box before falling over Lucas Neill's prone body.
Totti kept his nerve to convert with the last kick of the game, breaking Australian hearts in Kaiserslautern.
Luca Toni had earlier missed Italy's best chances, before Marco Materazzi's red card for a foul on Marco Bresciano.
The former Everton defender's dismissal, which was harsh to say the least, altered what had been an open game up until then, as both sides seemed to settle for keeping it tight.
The Socceroos, who had escaped on numerous occasions when Italy's strikers should have done better earlier in the game, failed to make the most of their one-man advantage despite a wealth of possession.
Tim Cahill, with a header, and Bresciano, with a long-range stinger, came close to snatching what had appeared to be an unlikely win before the game late on.
But, in truth, Italy keeper Gianluigi Buffon was largely untested and Guus Hiddink's side paid the price in the third minute of stoppage time when Totti, surprisingly left out in favour Alessandro del Piero, bagged his first goal of the competition.
It was reward for another superb defensive display from Marcelo Lippi's side, even if their attacking efforts left a lot to be desired.
Materazzi's sending off was harsh
Toni in particular was the most guilty in a profligate Azzurri attack, though he was unfortunate not to have done better with a header that went just wide early on and a later turn and shot that Mark Schwarzer stopped with his feet.
Other chances went begging for Italy, as Alberto Gilardino also failed to make the most of some decent openings without Schwarzer having to make another decent save.
But, after Materazzi's harsh dismissal, it was Australia who dominated possession and the shame for them was that they could only produce neat and tidy football, which was ultimately toothless without the injured Harry Kewell.
Scott Chipperfield, on his 50th international appearance, wasted their two best chances - twice firing straight at Buffon when well placed in the area.
And he and Australia were left to rue their lack of ambition at the death, as Totti stepped up to go some way to redeeming himself after a lacklustre tournament so far and stretch Italy's current run to 22 matches unbeaten.
The Azzurri will now play Ukraine after Oleg Blokhin's side defeated Switzerland on penalties in Cologne.
Italy: Buffon, Zambrotta, Cannavaro, Materazzi, Grosso, Del Piero (Totti 75), Perrotta, Gattuso, Pirlo, Gilardino (Iaquinta 45), Toni (Barzagli 55). Subs Not Used: Zaccardo, Peruzzi, Amelia, Camoranesi, Barone, Inzaghi, Oddo, Nesta.
Sent Off: Materazzi (51).
Booked: Grosso, Gattuso, Zambrotta.
Goal: Totti 90 pen.
Australia: Schwarzer, Chipperfield, Neill, Moore, Culina, Wilkshire, Cahill, Grella, Bresciano, Sterjovski (Aloisi 81), Viduka. Subs Not Used: Popovic, Skoko, Kalac, Kennedy, Lazaridis, Covic, Beauchamp, Kewell, Thompson, Milligan.
Booked: Grella, Cahill, Wilkshire.
Ref: Luis Medina Cantalejo (Spain).
Fifa man-of-the-match: Gianluigi Buffon
This was only the seventh match in World Cup history to be decided by a goal in the last minute of normal time, and the first last minute deciding goal to be scored from the penalty spot. Substitute Francesco Totti became the 21st player to score at this World Cup having not started the match. It equals the competition record from 2002. It was the 14th goal scored by an Italian substitute in World Cup finals and the fourth at this tournament, both records.
The penalty was Italy's ninth spot kick in World Cup history. Only five nations have been awarded more. Seven of the nine have been successfully converted. Marco Materazzi's red card was the seventh shown to an Italian player in World Cup finals. Only Brazil and Argentina have received more.
Italy are unbeaten in their last 22 international matches, their longest undefeated sequence since 1939.
Trivia stats source: Infostrada Sports