The Wallabies went over early on through Berrick Barnes, after he was put through by Craig Cooper who soon left the pitch with a cruciate injury, which is reportedly set to keep the fly-half out for around six months.
A James Hook penalty to put Wales on the board was the only other score of the first half as Australia went in with a four-point lead at the break.
Shane Williams then put the Welsh ahead after some intricate work with his feet, although replays suggest that James Hook's pass to the winger was a forward one.
Two penalties from James O'Connor and a Barnes drop-goal restored Australia's lead before Stephen Jones kicked Wales within touching distance.
They were unable to close the gap and a late try from Ben McCalman put the Wallabies out of sight.
Despite the fact that the Welsh knew they could not claim victory, they battled on past the 80 minute mark and were rewarded for their persistence when Halfpenny went over to leave the game with just a three-point deficit at the end.
The final takes place at Eden Park on Sunday morning when France take on hosts New Zealand.