South Africa came within 32 runs of winning the first Test, while Pakistan needed just two wickets to succeed as the competition headed to a thrilling finish on the fourth day at Centurion on Sunday.
Mohammad Abbas took Pakistan to the brink of an extraordinary victory by taking four wickets in a marathon spell of 13 consecutive overs as South Africa put in hard work to chase a modest target of 148.
They were 116-8 at lunch with their hopes pinned on the fast bowling pair of Marco Jansen (five) and Kagiso Rabada (10), who were not out at lunch.
Abbas, whose overall figures were 6-43 in 17 overs, caused a dramatic collapse after South Africa looked headed for victory with 50 runs needed and six wickets in hand.
His haul included the fortunate dismissal of captain Temba Bavuma for 40, who walked after thinking he had passed the ball towards the keeper, but will regret not reviewing the decision as television replays showed he had not touched his bat but his pocket. on the way.
Abbas also bowled Aiden Markram and caught David Bedingham and Corbin Bosch behind – Bosch was first to the ball to see South Africa fall from 96-4 to 99-8.
Pakistan are on the verge of their first Test victory in South Africa in 18 years, while the home team chases a victory that will secure them a place in the World Test Championship final in June.
Aiming modestly to win the first of a two-Test series, South Africa were 27-3 overnight but were looking for victory as Bavuma and Markram advanced the score in a positive start to Sunday.
But Abbas, back in the team after a three-year absence, turned the tide in Pakistan’s favor when he bowled Markram for 37 before Bavuma’s unusual dismissal.
The home team’s collapse then saw Kyle Verreynne (2) bowled by Naseem Shah and Bedingham (14) and Bosch attempted to drive rising deliveries from Abbas but both got close to wicketkeeper Mohammad Rizwan.