DUBAI: Yasir Shah cast his spin magic in the closing hour of the final day of the first Test in Dubai to take Pakistan to the brink of victory on Thursday.

But, Time Paine and Nathan Lyon’s tenacity was just too much to handle as they held their own and managed to draw a historic test match.

Shah ended opener Usman Khawaja’s fighting innings at 141 and then removed Mitchell Starc and Peter Siddle in quick succession to keep Pakistans victory hopes alive.

Australia were set a daunting 462-run target by Pakistan.

Pakistan need two more wickets to take a 1-0 lead in the two-match series.

Pakistan failed to get a single wicket in the first session after Australia resumed at 136-3.

Khawaja took a single to short mid-wicket off to Mohammad Hafeez to complete his century.

No team has successfully chased more than the 418-7 West Indies made against Australia in the Antigua Test in 2003.

Pakistan had expected early wickets after jolting Australia to 136-3 at the close on the fourth day, but nothing worked for skipper Sarfraz Ahmed, who made multiple bowling changes.

Pakistan could have had Head leg-before off leg-spinner Yasir Shah on 44, but Sarfraz did not review English umpire Richard Kettleboroughs not out decision when replays showed the ball hitting the wickets.

Pakistan were only rewarded after lunch when they took the second new ball as soon as it was due and Hafeez trapped Head leg-before with the first ball.

Yasir Shah took his first in the match when he dismissed Marnus Labuschagne for 13.