Rhys Priestland kicked an injury-time penalty to seal Wales a 29-28 victory over 14-man Australia in a tense Test match at the Principality Stadium in Cardiff on Saturday.
It looked like the Wallabies had grabbed an unlikely victory when Kurtley Beale hit a 77th-minute penalty, but there was drama to the end as Priestland booted the winning kick.
Priestland had replaced Dan Biggar, whose 16 points were crucial to the Welsh victory in front of more than 68,000.
Wales scored a try in each half through Ryan Elias and Nick Tompkins, while Australia were reduced to 14 players after No 8 Rob Valetini was red carded in the 15th minute.
The Wallabies, however, outplayed the home side for large periods of the game, scoring two spectacular second-half tries through Nic White and Filipo Daugunu -- after the opening try from Andrew Kellaway -- to keep in the hunt to the death.
"The red card is one of those ones, it's clumsy, but these days it is a red card," Wales captain Ellis Jenkins told Amazon Prime Video.
"It was a tough one, we made it more difficult for ourselves than we had to. They played some lovely stuff, it's lung-busting trying to defend it.
"Sometimes you need to win ugly and we'll take that today."
Jenkins' Australian counterpart James Slipper rued a lack of discipline.
"In Test matches you can't win when you put yourself under that pressure," he said.
"We put ourselves in a position to win it at the end, they showed a lot of character to fight tooth and nail... but Wales were just good enough to get the win."
Australia, left winless on their European autumn tour for the first time since 1976 after previous losses to Scotland and England, came out with all guns firing, winger Kellaway latching on to a smart Hunter Paisami grubber kick to continue his prolific try-scoring form after just two minutes.
James O'Connor converted but the Wallabies infringed from the restart and Biggar nailed a penalty.
Drama ensued as Valetini was shown a red card by Scottish referee Mike Adamson for a reckless head-on-head tackle that left a bloodied Adam Beard helped from the pitch.
Biggar kicked the resulting penalty, with the Wallabies now down to 14 men for 65 minutes.
O'Connor, who made his international debut in the same fixture back in 2011, hit a penalty of his own to extend Australia's lead, but referee Adamson was left with no option other than yellow carding veteran full-back Beale for a deliberate knock-on.
Biggar spurned a penalty kick to go to the corner and, from the resulting line-out, scrum-half Tomos Williams darted around the maul to play Elias in at the corner in a well-worked move.
The Welsh fly-half kicked the conversion yet more ill-discipline saw O'Connor boot a second penalty to draw the scores level.
Biggar kicked his third penalty to leave Wales with a 16-13 half-time lead, both sides struggling to find any fluency in their play.
- Frenetic pace -
The second period opened at a frenetic pace, Tompkins crossing for an opportunistic try for Wales after palming down a forced pass from replacement Wallaby wing Tom Wright, Biggar adding the conversion.
Replacement prop Gareth Thomas was then yellow carded for a swinging arm to the face of Allan Alaalatoa.
With both teams down to 14, Australia scored the try of the match, Beale stepping inside New Zealand-born Wales centre Uilisi Halaholo to find Lalaki Foketi in support, the replacement back holding the ball up perfectly for White, who bounced over the line.
O'Connor kicked the conversion, but Biggar then kicked a 40-metre penalty after Will Skelton took out Josh Adams, making it 26-20 with 15 minutes to play.
Tension was guaranteed as Paisami split the midfield defence, the ball was quickly recycled and Daugunu literally went head over heels while dotting down in the corner to bring Australia within one point of Wales, O'Connor missing the conversion.
Beale then stepped up to bang over what looked like a game-winning three-pointer, before Wales pushed, Australia infringed and Priestland made no mistake.