Pakistan, set a huge target of 343 for victory after England declared on 445 for six early on Sunday’s final day, were dismissed for 201.
Man-of-the-match Ali, who earlier on Sunday struck a quickfire 86 not out — his second fifty of the match — sealed England’s win when the off-spinner caught and bowled Sohail Khan.
Pakistan suffered a dramatic middle-order collapse shortly before tea as they lost four wickets for just one run in 23 balls. They had been comfortably placed at 69 for one come lunch but lost six wickets in the second session as England made the most of the slight reverse swing on offer.
“It’s one of my most enjoyable wins as captain as everyone contributed,” England captain Alastair Cook told BBC Radio’s Test Match Special.
Ali added: “We were behind the eight-ball a little bit, but fought back brilliantly.
“Our seamers were fantastic, it showed how good they are.”
Misbah-ul-Haq, the Pakistan captain, said: “England reversed the ball, bowled in the right areas, and within an hour they took the game away from us.
“Sometimes when the ball starts reversing you just need to see off that 10-15 overs so the ball gets soft, but we lost all our main batsmen then.”
Pakistan were 124 for three when their slump started, with Misbah (10) caught behind off Steven Finn to give the persevering fast bowler his first wicket of the series.
Asad Shafiq then completed a pair when he was plumb lbw to all-rounder Chris Woakes, bowling on his Warwickshire home ground, for a four-ball duck.
Woakes then made it two for none in six balls when Sarfraz Ahmed was also out for nought as he edged to Joe Root at second slip.
Sami Aslam, playing his first Test of the series, had again batted superbly for 70 following the opener’s first-innings 82. But a rare misjudgement by the 20-year-old left-hander saw him bowled by Finn as he deliberately left the ball.
It was the end of an innings that last more than three and-a-half-hours, with Aslam hitting 11 fours. Finn had now taken two for none in 11 balls.At tea, Pakistan were 148 for seven, with Yasir Shah seven not out and Mohammad Amir 15 not out.
With all their specialist batsmen dismissed, Pakistan’s tail had to survive the remaining 28 overs to hold out for a draw. But five balls after the break, Shah edged James Anderson, England’s all-time leading wicket-taker, to Alex Hales in the slips.
Pakistan were on the brink of defeat at 151 for nine when Amir drove Stuart Broad straight to Woakes at point. But a last-wicket stand of 50 in 67 balls between Sohail and Rahat Ali (15 not out) kept England at bay before Moeen Ali struck the clinching blow with 13.1 overs left in the day.
All five of England’s frontline bowlers — Anderson, Broad, Finn, Woakes and Ali — took two wickets apiece Sunday.
Pakistan’s chase started poorly when Mohammad Hafeez (two) fell cheaply for the second time in the match before Aslam and Azhar Ali, who made 139 in the first innings, put on 73.
But Moeen Ali dismissed Azhar on 38 when he edged a loose drive to Cook at second slip. Cook decided against declaring before the start of Sunday’s play even though England had a lead of 311 runs.
Jonny Bairstow was 82 not out and Ali 60 not out after their century stand had taken the match away from Pakistan on Saturday.
Birmingham-born Ali, who grew up near Edgbaston, struck 19 runs in the first over of Sunday’s play from leg-spinner Shah, including two successive sixes.
Bairstow had added just one run to his overnight score when he was lbw to Sohail on review. Ali had faced just 96 balls, including 10 fours and two sixes, when Cook declared four overs into Sunday’s play.
England 1st Innings 297 (G Ballance 70, M Ali 63; Sohail Khan 5-96)
Pakistan 1st Innings 400 (Azhar Ali 139, Sami Aslam 82, Misbah-ul-Haq 56; C Woakes 3-79, S Broad 3-83)
England 2nd Innings (overnight: 414-5)
A. Cook c Yasir Shah b Sohail Khan 66
A. Hales c Younis Khan b Mohammad Amir 54
J. Root c Mohammad Hafeez b Yasir Shah 62
J. Vince c Younis Khan b Mohammad Amir 42
G. Ballance c Asad Shafiq b Yasir Shah 28
J. Bairstow lbw b Sohail Khan 83
M. Ali not out 86
C. Woakes not out 3
Extras (b4, lb7, w2, nb8) 21
Total (6 wkts dec, 129 overs, 567 mins) 445
Did not bat: S Broad, S Finn, J Anderson
Fall of wickets: 1-126 (Cook), 2-126 (Hales), 3-221 (Root), 4-257 (Vince), 5-282 (Ballance), 6-434 (Bairstow)
Bowling: Amir 31-8-75-2 (1w); Sohail 29-3-111-2 (8nb, 1w); Rahat 21-8-54-0; Shah 43-4-172-2; Azhar 5-0-22-0;
Pakistan 2nd Innings (target: 343)
Mohammad Hafeez c Woakes b Broad 2
Sami Aslam b Finn 70
Azhar Ali c Cook b Ali 38
Younis Khan c Bairstow b Anderson 4
Misbah-ul-Haq c Bairstow b Finn 10
Asad Shafiq lbw b Woakes 0
Sarfraz Ahmed c Root b Woakes 0
Yasir Shah c Hales b Anderson 7
Mohammad Amir c Woakes b Broad 16
Sohail Khan c and b Ali 36
Rahat Ali not out 15
Extras (lb2, nb1) 3
Total (all out, 70.5 overs, 299 mins) 201
Fall of wickets: 1-6 (Hafeez), 2-79 (Azhar), 3-92 (Younis), 4-124 (Misbah), 5-125 (Shafiq), 6-125 (Sarfraz), 7-125 (Aslam), 8-149 (Shah), 9-151 (Amir), 10-201 (Sohail)
Bowling: Anderson 13-3-31-2; Broad 15-7-24-2 (1nb); Woakes 11-2-53-2; Finn 13-5-38-2; Ali 17.5-4-49-2; Root 1-0-4-0;
Result: England won by 141 runs
Man-of-the-match: Moeen Ali (ENG)
Series: England lead four-match series 2-1
Aug 11-15: Fourth Test, The Oval
Jul 14-17: 1st Test, Lord’s: Pakistan won by 75 runs
Jul 22-25: 2nd Test, Old Trafford: England won by 330 runs