Australia's Mike Harris kicked a penalty under huge pressure after the full-time siren to give the Wallabies a 25-23 win and break Welsh hearts in Melbourne on Saturday.
Harris' kick from the sideline -- when the replacement had only been on the field for seven minutes -- denied Wales their first win in Australia for 43 years, and secured the series for the home team.
The Wallabies will head to Sydney next week aiming to sweep the three-match series after winning the opening Test 27-19 in Brisbane last weekend.
The Welsh players hung their heads in despair after a committed defensive effort to contain Australia to just one try from Rob Horne, while crossing the line twice themselves through George North and Jonathan Davies.
Wallabies' coach Robbie Deans said his team showed great composure to secure the win.
"We knew that when we play Wales they're an 80-minute side, they've very much a second-half side," he said.
"Fortunately, the boys had enough composure when they were under the pump at the death to get their hands on the ball one more time, produce some pressure and produce an outcome."
Wales' caretaker coach Rob Howley pointed out his side had been 20 seconds away from winning their first Test in Australia since 1969.
"We're hugely disappointed having outscored Australia two tries to one," Howley said.
"I thought our defensive effort throughout the game was absolutely outstanding and we negated a lot of Australia's strengths and in international rugby it's all about those fine margins.
"We gave them the opportunity through a lack of discipline in those last two minutes which they took."
The lead changed hands eight times in the second half, with Australian man-of-the-match Berrick Barnes landing a conversion and five penalties, and Wales' Leigh Halfpenny kicking two conversions and three penalties.
The Six Nations champions had a dream start with left-winger North plunging over in the fourth minute next to the posts after early pressure.
Australia got more possession and territory but were made to work hard before Barnes kicked two penalties, leaving the home side trailing by one point after 30 minutes.
In one passage the Wallabies went through 18 phases, but Wales' defence held firm.
The Wallabies finally cracked the resolute Welsh when Barnes dummied his way past centre Ashley Beck and sent Horne racing away to score, giving the hosts a 13-7 half-time advantage.
But four minutes after the resumption Wales pounced on an errant Will Genia pass from a lineout and Beck toed through for Jonathan Davies to win the chase and score a converted try for a 14-13 lead.
North was penalised for holding on a few minutes later and Barnes kicked the Wallabies back in front from wide out.
But in a see-sawing contest, Halfpenny nudged Wales ahead with a penalty after 51 minutes.
The Wallabies had another 15 phases inside the Welsh quarter before regaining the lead with an offside penalty scored by Barnes.
Australia were reduced to 14 men when winger Cooper Vuna was yellow-carded for tackling Halfpenny in mid-air as the Welsh fullback leaped for a high kick. Vuna was cited by the match commissioner afterwards for a dangerous tackle.
Halfpenny picked himself off the ground to land the penalty for Wales to lead again on the hour, only for Barnes to reclaim it with another three-pointer for 22-20.
Again a Halfpenny penalty put Wales in front and within sight of a historic win, and Barnes missed for the first time in the match when he had a chance to put Australia ahead after a scrum penalty, going off immediately afterwards.
But as the Wallabies pressed in the dying seconds the Welsh were penalised in a rolling maul, and Harris had the final say.