After Wales winger George North barged over to put the Six Nations champions ahead in the third minute of the second Test, the lead changed nine times as Australia stand-off Berrick Barnes and Wales full-back Leigh Halfpenny traded kicks.
Barnes kicked 14 points and set up Australia’s lone try for Rob Horne, while Halfpenny scored 13 points with the boot.
Two penalties from Barnes and a try from Horne meant Australia went into half time leading 13-7 but Wales replied three minutes into the second half, Ashley Beck kicking a grounded ball ahead for Jonathan Davies to score.
Barnes and Halfpenny traded penalties before another penalty allowed Australia to again edge into a one-point lead.
The advantage was short-lived as Australia were reduced 14 men when Cooper Vuna was sin binned for a dangerous tackle, and Halpenny kicked the penalty.
Barnes converted a 65th-minute penalty but Halfpenny put Wales ahead 23-22 two minutes later.
Australia won the first match in Brisbane 27-19 and the teams play the third and final Test in Sydney on Saturday.
Scorers: Australia: Try: Horne. Con: Barnes. Pens: Barnes 5, Harris. Wales: Tries: North, Davies. Cons: Halfpenny 2. Pens: Halfpenny 3.
Australia: Ashley-Cooper; Vuna, Horne, McCabe, Ioane; Barnes, Genia; Palu, Pocock (c), Higginbotham, Sharpe, Simmons, Kepu, Polota-Nau, Robinson. Subs: Moore, Alexander, Dennis, Hooper, White, Fainga’a, Harris.
Wales: Halfpenny; Cuthbert,J Davies, Beck, North; Priestland, Phillips; R Jones, Warburton (c), Lydiate, A W Jones, B Davies, A Jones, Rees, Jenkins. Subs: Hibbard, James, Charteris, Tipuric, Webb, Hook, Williams.
Referee: C Pollock (NZ). Attendance: 33,888.