Second Test, Headingley, (day three, close): Pakistan 258, 140-3 v Australia 88 & 349
Live commentary on Test Match Special and Radio Five Sports Extra, scorecards on BBC website, live on Sky Sports
All-rounder Steven Smith hit two sixes in his entertaining 100-ball knock
Pakistan are 40 runs short of their first Test victory against Australia in almost 15 years and levelling the two-match series at Headingley.
Set a fourth-innings target of 180 to chase after dismissing Australia for 349, Pakistan ended day three on 140-3.
Late hitting from all-rounder Steven Smith (77) gave Australia an outside chance of pulling off an unlikely win.
Doug Bollinger (2-37) offered hope but Imran Farhat (67) and Azhar Ali (47 not out) put Pakistan on the brink.
Pakistan's last Test victory against Australia was in November 1995 when Mushtaq Ahmed spun Wasim Akram's side to a 74-run victory at the Sydney Cricket Ground.
But since then Pakistan have lost 13 successive Tests against Australia, including a humiliating 4-0 series drubbing at the end of 2009, a tour plagued by internal turmoil and personality clashes.
But new captain Salman Butt, installed as Shahid Afridi's successor following the 150-run defeat at Lord's last week, has the opportunity to cast aside the politicking and fulfil Pakistan's abundant potential.
Central to his future plans is Mohammad Aamer, the left-arm seamer who snared the crucial breakthrough three overs into the morning session when Ricky Ponting edged a wide delivery outside off stump to wicketkeeper Kamran Akmal for 66.
It was the fifth time the 18-year-old has dismissed the Australia captain in Tests - and he followed that up with two further wickets as left-handers Mike Hussey and Marcus North were returned to the pavilion in rapid succession to leave the tourists at 164-5.
A belligerent innings from Michael Clarke stymied Pakistan's hopes of wrapping up the second innings and chasing down a small target as the Australia vice-captain complied a patient 53-run sixth-wicket partnership alongside Tim Paine.
But the momentum of the match shifted towards Pakistan when Clarke edged Mohammad Asif behind in the 67th over for 77.
With the prospect of defending a relatively small fourth-innings target, new man Smith pushed Australia into a three-figure lead with a superbly timed counter-attack.
The all-rounder hit seven boundaries and two successive straight sixes off leg-spinner Danish Kaneria in an entertaining 100-ball knock of 77.
Farhat was particularly severe on anything short outside off stump
The 20-year-old Smith was the last wicket to fall in the third session, leaving Pakistan's openers the challenge of building a solid platform to set up a much-needed and morale-boosting victory.
Australia's response was swift as opener Farhat edged Doug Bollinger to first slip but Shane Watson could not cling on with the score at 4-0.
And the left-hander capitalised on the opportunity to compile his 95-ball innings, punishing anything short outside his off stump through point, before he was cleaned up by a Bollinger yorker at 137-2.
Farhat's second-wicket, 110-run partnership alongside the patient and obdurate Ali exhausted Australia's pace trio, who attempted to extract as much bounce and movement from the responsive surface as possible but with little success.
However, Bollinger gave Australia a huge fillip before the end of day's play when he had Umar Amin caught behind for a duck.
Ali remains unbeaten alongside the dashing Umar Akmal, with both men set to return to knock off the remaining 40 runs on Saturday.