(CNN) -- Pakistan are poised to end a run of 13 straight Test defeats to Australia after close of play on the third day of the second Test at Headingley.
At stumps, Pakistan had reached 140 for the loss of just three wickets, needing just 40 runs to claim their first victory over Australia since 1995.
Resuming on their overnight score of 136 for two, 34 behind Pakistan's first innings total of 258, Australia soon lost captain Ricky Ponting -- who added just five more runs before being caught behind off Mohammad Aamer for 66.
Teenager Aamer went on to take three wickets for just 12 runs in 16 balls, on his way to a Test-best match return of seven for 106.
Australian spinner Steven Smith was last man out for 77 as his side reached 349 -- a vast improvement on their humbling first innings total of 88.
In reply, Pakistan lost captain Salman Butt for just 13 and paceman doug Bollinger followed up with the wickets of Imran Farhat (67) and Umar Amin for a duck in the space of just seven balls.
However, Azhar Ali, playing only his second Test match, remained at the crease and was 47 not out when play ended for the day.
Despite looking set for victory, Pakistan will not need reminding that they were bowled out for just 139, chasing a total of 176, by the Aussies in Sydney in January.