Wales put one foot in the Rugby World Cup quarter-finals and stated their case as major title contenders after beating Australia 29-25 at Tokyo Stadium.
The Six Nations champions took charge of Pool D with a second straight win that could lead to a last-eight clash against France or Argentina.
Australia, though, might be hurtling towards a knockout tie with England, who are coached by former Wallabies boss Eddie Jones, despite staging a spectacular second-half fightback.
Wales looked home and dry when they led 26-8 through tries by centre Hadleigh Parkes and scrum-half Gareth Davies.
Fly-halves Dan Biggar and Rhys Patchell kicked 19 points between them – Patchell contributed 14 after replacing Biggar, who went off for a head injury assessment – but Australia got it back to one point at 26-25.
Wing Adam Ashley-Cooper, full-back Dane Haylett-Petty and captain Michael Hooper claimed touchdowns, with Bernard Foley kicking a penalty and Matt Toomua booting seven points.
LATEST SPORT NEWS
Deontay Wilder next fight: When does star return to action? Who is he facing?
Leicester ace reveals he turned down Arsenal transfer and explains why
Nicola Adams suffers first blip of professional career on Daniel Dubois card
Anthony Joshua reveals who he'd rather face – Deontay Wilder or Tyson Fury?
Deontay Wilder's next fight officially announced with opponent, date and venue
Daniel Dubois destroys Ebenezer Tetteh with brutal first-round knockout
Unbeaten Archie Sharp loses first three rounds, then scores massive one-punch KO
Canelo Alvarez next fight: When is he in action again? Who is he fighting?
But Wales held out, helped out by Patchell’s 72-minute strike, to beat Australia for only a second time in the last 15 Tests following a scintillating contest.
Alun Wyn Jones became Wales’ most-capped player as he led his country out, making his 130th appearance to break the record he previously shared with prop Gethin Jenkins.
Australia were without suspended wing Reece Hodge – replaced by Ashley-Cooper – while half-backs Foley and Will Genia were also called up by head coach Michael Cheika.
Wales made a dream start and were ahead after just 36 seconds when the Welsh pack secured quality possession inside Australia’s 22 and Biggar dropped a goal.
Australia were rocked by the ferocity of Wales’ start, and Biggar went close to doubling the lead but drifted a touchline penalty attempt wide.
Wales were outstanding with ball in hand, looking to involve wings George North and Josh Adams at regular opportunities.
Australia’s defence came under considerable pressure, and Wales increased their lead through a 13th-minute try.
Biggar was the architect, kicking to the wing, and centre Parkes climbed above Wallabies wing Marika Koroibete, before spinning and touching down.
Biggar’s successful touchline conversion made it 10-0, and Hooper was then warned by referee Romain Poite for a challenge on the Wales number 10.
Australia opened their account with a 21st-minute try by Ashley-Cooper after Foley’s kick found space, cutting their deficit by five points.
Centre Samu Kerevi began to cause problems for the Welsh defence with his powerful running, and Wales then lost Biggar for a head injury assessment, with Patchell replacing him.
Foley booted a penalty shortly afterwards, and Wales’ lead had been reduced to 10-8 after 30 minutes.
Wales needed to regroup, and a Patchell penalty seven minutes before half-time restored the Six Nations champions’ five-point advantage, then he kicked another three-pointer from almost 50 metres.
And it then got even better for Wales when scrum-half Davies intercepted a Wallabies pass on halfway and sprinted clear to score their second try. Patchell’s conversion put Wales 15 points in front, ending an opening 40 minutes they had dominated.
Biggar did not rejoin the action, but Patchell had acquitted himself impressively at the hub of a controlling Wales performance. And he underlined it following another spell of Wales pressure by landing a drop-goal that meant Wales had an 18-point lead.
But Australia then hit back following a flowing long-range move which ended with Haylett-Petty crossing for a try that Toomua converted. The touchdown gave Australia a new lease of life, sensing that one more try would put them well and truly back in the contest.
Wales knew it, too, but Wallabies pressure was mounting, and three close-range driven line-outs saw Australia continue to turn the screw.
And Wales could not hold out, with Hooper claiming a touchdown following relentless pressure, and Toomua’s conversion meant Australia trailed 26-22 with 18 minutes left.
Toomua and Patchell then exchanged kicks, but Wales held out and claimed arguably the finest victory of head coach Warren Gatland’s long reign.