(CNN) -- Australia scored a dramatic two-wicket win over Pakistan off the last ball of their match at Centurion Park on Wednesday to reach the semifinals of the Champions Trophy.
Lee (left) and Hauritz took Australia to a thrilling victory.
Australia appeared to be cruising to victory chasing a modest 206 for victory, but a middle order collapse left tailenders Brett Lee and Nathan Hauritz to see them home.
Defeat would have given India the chance of progressing to the semifinals from Group A with their seven wicket victory over West Indies at the Wanderers in the other match on Wednesday.
Australia, who top the group after two wins and a no result against India, will now face arch-rivals England in the first of the last four clashes on Friday with Pakistan taking on New Zealand in the other semifinal.
Pakistan, who had already qualified ahead of the match, were always struggling in their 50 overs on a wicket helpful to all bowlers.
Kamran Akmal, captain Mohammad Yousuf and Misbah ul-Haq all made scores in the 40s against an accurate Aussie attack led by Shane Watson with 2-30 and Mitchell Johnson 2-45.
Australia made a solid start and appeared to be racing to victory until captain Ricky Ponting was caught on the boundary for 32 off Saeed Ajmal to end a stand of 81 with Michael Husssey.
When man of the match Hussey went for 64, Pakistan scented an unlikely victory with Naved ul-Hasan bowling two straight maiden overs as the runs dried up.
But Lee, who made 12 off 15 balls, and Hauritz (9 not out) scurried a series of singles, their place in the semifinals assured with a run off the penultimate ball to guarantee at least a tie.
Neither seemed aware that it was sufficient and a hurried run off the final ball which went straight through to wicketkeeper Akmal gave them a dramatic victory.