(CNN) -- Australia recovered from losing two key players inside the first 22 minutes to beat Wales 21-18 in Auckland Friday to secure third place at the Rugby World Cup.
Two-time world champions Australia lost fullback Kurtley Beale to injury after eight minutes, but center Berrick Barnes crossed for a converted try for the Wallabies to open the scoring at Eden Park.
The Australians then saw influential flyhalf Quade Cooper limp off with suspected cruciate ligament damage to his knee before James Hook got Wales on the score sheet with a penalty.
Australia's James O'Connor, with a penalty that struck the upright, and Leigh Halfpenny missed kicking chances for their respective sides to leave it 7-3 at halftime.
Hook, once again struggling with the boot, should have slotted over a three-point attempt early in the second half but it was quickly forgotten as veteran wing Shane Williams, playing in the final World Cup match of his career, produced a moment of magic in the 49th minute.
He controlled a loose ball before gathering to go over in the corner and put Warren Gatland's men in front for the first time in the playoff.
But Hook missed the conversion and the Wallabies responded with two penalties from 21-year-old O'Connor to take a 13-8 lead after 65 minutes.
Barnes, 25, extended Australia's advantage with a drop goal, before flanker Ben McCalman touched down for the decisive try with 76 minutes on the clock.
Wales, who have enjoyed their most successful World Cup campaign since the tournament was last held in New Zealand 24 years ago, finished with a flourish, wing Halfpenny grabbing a try on the 80-minute mark.
New Zealander Gatland said there were plenty of positives his team could take from their performance in the tournament, but lamented the poor kicking which ultimately cost Wales the bronze medal.
"We've got to look at the disappointment of not finishing third or reaching the final," Gatland said. "But there are a lot of positives to take out of this tournament. We've brought a lot of young players through.
"We've just got to keep looking to improve. We only lost 21-18 to one of the best sides in the world. So there are a lot of positives in that. We missed one or two easy ones and James O'Connor has kicked pretty well. That's probably been the difference."
It is the first time Australia have finished third at the four-yearly tournament, having been crowned champions in 1991 and 1999, runners-up in 2003 and fourth in 1987.
The World Cup reaches a climax Sunday at the same venue, with hosts New Zealand hoping to lift the Webb Ellis trophy for the first time in 24 years when they take on France, who have never won the tournament.