LONDON (AP) -- Bernard Foley kicked a last-minute penalty goal to rescue Australia's Rugby World Cup campaign with a 35-34 win over a plucky Scotland on Sunday and knock out the last northern hemisphere team.
The Australians trailed 16-15 at halftime despite scoring three tries to one, and crossed for two more tries to lead 32-24 with 15 minutes to play.
But Scotland, which placed last in the Six Nations and wasn't given much hope of beating the two-time champions in the last of the quarterfinals, took the lead when center Mark Bennett intercepted a pass and sprinted 30 meters untouched to score between the posts with five minutes to play. Skipper Greig Laidlaw, who kept Scotland in touch with five penalties and an earlier conversion, converted to give his team an unlikely 34-32 lead.
Heading into the last minute, Scotland was penalized for offside, giving Foley a chance to make amends for his three missed conversions in the first half.
Under the rain and raucous booing from the massive contingent of Scots at Twickenham, the Australian flyhalf slotted the winning goal.
"That's a penalty and that's how it works -- that's life," Australia coach Michael Cheika said, to another chorus of boos and howls. "You've still got to kick it."
For the first time at the World Cup, the semifinals will feature all four teams from the southern hemisphere's Rugby Championship.
The Australians will play Argentina, which thrashed Ireland 43-20 earlier in Cardiff. Defending champion New Zealand, which thrashed France by a record margin, will play South Africa, which edged Wales in the other quarterfinals.
The Australians were the form team of the pool phase, beating England and Wales on consecutive weekends, but almost followed both of those teams out of the tournament.
Veteran winger Drew Mitchell scored a pair of tries, lifting his career tally to 14 and third place on the all-time World Cup list, and the Australians looked OK in attack but conceded three tries to poor defense or blunders, including a chargedown kick and the intercept.
There were too many uncharacteristic errors and the scrum that worked well in four previous games gave up needless penalties.
Scotland, supposedly the weakest of the Six Nations teams, gave the Rugby Championship winners a difficult time in a game that was expected to be a mis-match.
Australia opened the scoring with an Adam Ashley-Cooper try in the right corner in the ninth minute, but slipped behind 13-5 midway through the first half. Scotland played the percentages well and converted their trips into the Wallabies' 40 into points. Laidlaw landed three first-half penalty goals and converted Pete Horne's try in the 18th minute, when the Scotland center strolled over from close range because of non-existent defense behind the ruck.
Mitchell's try in the left corner after some sustained pressure kept the Wallabies in touch on the scoreboard in the 30th.
Trailing by six points about 90 seconds before the break, the Australians opted to kick for touch instead of goal when a late penalty was awarded, and it paid off. Michael Hooper burrowed over behind a driving maul from the resulting lineout.
The second half started badly for Scotland, with another seemingly harsh decision from a TV match official resulting in winger Sean Maitland getting yellow-carded for a deliberate knock-on when Australia had an unmarked man outside him. Mitchell dived into the corner for his second try seconds later, and Foley converted from the left sideline to give Australia a 22-16 lead.
The crowd loudly booed the decision, just another one that hurt the Scottish team in a highly disruptive week. Hooker Ross Ford and lock Jonny Gray were rushed back into the starting lineup an hour before the game, a day after their three-week ban for a dangerous tackle on a Samoa player last weekend was overturned on appeal.
Foley and Laidlaw traded penalties, and Australia had a try disallowed, to make it 25-19 before Finn Russell charged down Foley's attempted clearance kick and unloaded to a free Tommy Seymour, who burst into the corner. Laidlaw missed the conversion.
The Australians went close twice more before center Tevita Kudridrani took the direct path to the line and scored next to the posts in the 64th. Foley converted to make it 32-24 -- more than a converted try in it.
But rather than finish it off, that only set up the dramatic finish with the lead changing twice more.