The all-rounder finished 75 not out before taking 5-69 to bowl the tourists out for 202 and finished the series with 250 runs and 25 wickets in the process, the first man to do so for England since Ian Botham in the early 1980s.
Hashim Amla hit 83 whilst Faf Du Plessis added a half century but England claimed a 177-run win with over a day to spare in Manchester.
Morkel sees off England's tail
It took South Africa just 15 minutes to wrap up England's second innings as Morne Morkel finished with 4-41 to become South Africa's leading wicket taker in the series.
Stuart Broad went for five and Jimmy Anderson just two, leaving Ali stranded unbeaten on 75 from just 66 balls.
England were all out for 243 to leave South Africa needing a near-on impossible 380 to win.
England come out strong after rain
The last thing South Africa needed was an hour-rain delay to spice the already-difficult pitch up a little bit more, but that's what they got as Heino Kuhn and Dean Elgar to embark on their second innings.
Elgar avoided a pair after his first innings duck, but couldn't prevail against Broad in tough conditions as he edged behind for five.
Anderson and Broad were causing all sorts of problems for South Africa's top order and Kuhn rounded off a miserable series for the opener by prodding to Alastair Cook at slip.
Temba Bavuma became the next to go with the last ball before lunch, as Toby Roland-Jones picked up his first after a review by Root to leave the score 40-3 at lunch.
Anderson and Broad plugged away after tea but by hook or by crook Amla and Du Plessis survived and Amla reached his half century from 100 balls, the last 38 of which came from just 35 balls after scoring just 12 from his first 65 deliveries.
Ali makes the breakthrough
But a change of ends for Ali did the trick and he broke the 123-run stand by trapping Amla in front 17 short of his first first century of the summer.
That was South Africa's only 100-run stand of the series and two overs later Moeen was at it again finding both the outside edge of Quinton De Kock and Theunis De Bruyn to leave South Africa 173-6.
From there it all unravelled for Du Plessis' side, the captain went for a stubborn 61 before Ali finished the job for England with two wickets in two balls after Anderson removed Kagiso Rabada, meaning South Africa's last seven wickets had gone in just 12.3 overs for 39 runs.
England will now take on the West Indies in a three-match series starting in ten days time at Edgbaston.