South Africa’s win meant that only one of Australia and India can qualify for the final at Lord’s in June.
Pakistan captain Shan Masood said he was proud of the effort of his players but lamented the failure to take ruthless advantage of their opportunities.
“Twice we had them eight down and with the bat we could have extended our first innings and could have extended our lead (in the second innings). We have to learn to seize the moments.”
Masood said Abbas, playing in his first test in more than three years, had been “sensational”.
The 34-year-old Abbas took a career-best 6/54. He bowled unchanged for 19.3 overs - four of them on Saturday when he took his first two wickets – in a spell of unremitting accuracy on a pitch which gave seam bowlers help throughout the match.
Man of the match Aiden Markram and Bavuma batted solidly at the start of the day after resuming on 27 for three.
However, Markram was bowled by Abbas for 37 by a virtually unplayable ball which kept low and seamed back off the pitch.
Bavuma and David Bedingham added another 34 runs until Bavuma uncharacteristically charged down the pitch at Abbas and was given out caught behind for 40.
He walked off immediately but Ultra Edge technology showed the only ‘spike’ was when the ball brushed his trouser pocket.
It was the first of four wickets which fell for three runs in 12 balls.
Naseem Shah bowled Kyle Verreynne and Abbas had Bedingham and Corbin Bosch caught behind off successive deliveries.
Rabada and Jansen saw South Africa through to lunch at 116/8 – then polished off the match in just 5.3 overs after the interval, with each stroke cheered by the home spectators.
Both sides have a short break before they meet for the second and final test in Cape Town on January 3.