The veteran batsman's 218 was the centrepiece of Pakistan's 542 all out at tea on the third day in reply to England's 328.
That left Pakistan with a first-innings lead of 214 runs as they looked to end the four-match series all square at 2-2.
England won the third Test at Edgbaston by 141 runs after overturning a first-innings deficit of 103 runs.
But only six times in properly completed matches in the 139-year history of Test cricket have a team come back from more than 200 runs behind on first innings to win.
Younis received excellent support in a ninth-wicket stand of 97 from
Mohammad Amir, whose 39 not out was the left-arm quick's highest Test score.
Younis's sixth innings of 200 or more in Test cricket was a dramatic way for the 38-year-old to end a run of low scores.
He had managed just 122 runs in six previous innings this series, with a best of 33 in Pakistan's first Test win at Lord's.
Pakistan resumed on 340 for six after Asad Shafiq (109) and Younis (101 not out) had both compiled impressive centuries.
But it was Ahmed, 17 not out overnight, who was the initial aggressor on Saturday as he scored in typically brisk fashion.
By contrast it took Younis 13 balls to add his first run Saturday.
But when James Anderson gave him width outside off stump, Younis responded by cutting England's all-time leading wicket-taker in front of point for four.
And when Younis off-drove Stuart Broad for a boundary in classic style, it meant Pakistan's seventh-wicket pair had shared a fifty stand in 110 balls.
Younis, after his 'settling-in' period Saturday, looked increasingly fluent as the veteran batsman extended his 32nd Test century.
Ahmed was eventually out having struck seven fours in 78 balls when he edged a good-length Woakes delivery and opposing wicket-keeper Jonny Bairstow held an excellent, diving, one-handed catch.
Pakistan were now 397 for seven, with Woakes having taken his 26th wicket this series -- a marked contrast to the mere 16 the improving all-rounder managed in his first eight Tests.
The score had moved on to 403 for seven when Younis was given out lbw for 133 to tall fast bowler Finn.
But Younis immediately reviewed Bruce Oxenford's decision and, with replays showing the ball going over the top of the stumps, the Australian umpire's verdict was reversed.
Pakistan were 417 for seven at lunch, a lead of 89, with Younis 147 not out.
Soon afterwards, Younis went to 150 by pulling paceman Stuart Broad for four.
Curiously, despite the overcast, seam-friendly, conditions after lunch, England captain Alastair Cook brought on part-time spinner Joe Root and specialist off-break bowler Moeen Ali for eight consecutive overs from the Pavilion End.
Ali did have Wahab Riaz (one) stumped by Bairstow, although the keeper was lucky when a fumbled take rebounded straight into the stumps.
But Ali has often proved expensive this series and he was costly again when conceding 36 runs in six overs on Saturday.
Younis completed his double hundred in style when he advanced down the pitch to drive Ali for a fourth six in 281 balls.
Amir took 24 balls to get off the mark but did so in dashing fashion when he hoisted Ali for six over deep midwicket.
It was the start of a flurry of boundaries from the pace bowler.
England eventually ended the partnership when Anderson's yorker-length delivery struck Younis on the pad and South African umpire Marais Erasmus gave him out lbw.
Younis reviewed but replays showed the ball just clipping leg stump.
He walked off to a standing ovation from the Oval crowd after batting for more than seven-and-a-half hours in a 308-ball innings featuring 31 fours and four sixes.