Australia will meet Scotland in the Rugby World Cup quarter-finals after a victory over Wales in a brutal Pool A decider at Twickenham.
Early pressure from Warren Gatland's team allowed Dan Biggar to kick the Welsh into the lead and the Dragons tried to increase their advantage, but Gareth Anscombe was held up by dogged defending from Sean McMahon.
Wales showed resilience in defence themselves, keeping the Wallabies out of their own 22 for the first quarter of the game before Drew Mitchell was shepherded into touch after an initial line break.
Successive penalties from Bernard Foley put Australia ahead before stand-in captain Stephen Moore failed to move away from the tackle area, presenting Biggar with the chance to level the scores.
However, Toby Faletau was adjudged to have illegally stole possession, leading a third Foley penalty to give the two-time world champions a 9-6 lead at the interval.
Foley extended the Wallabies advantage with another kick, but successive infringements saw scrum-half Will Genia sent to the sin-bin on 56 minutes.
Wales decided to press for a try and, despite concerted pressure, Faletau managed to knock on with the line in reach.
Australia's increasing penalty count led to referee Craig Joubert giving lock Dean Mumm a yellow card as the Wallabies were reduced to 13 men.
However, Michael Cheika's men managed to withstand several phases of play and held up George North over the line and stayed six ahead after minutes of defending their own try-line.
Instead, Foley knocked over a fifth penalty and Alex Cuthbert's yellow card for a deliberate knock forward helped seal victory for the Wallabies.