In reply, Pakistan lost their first wicket before they had scored a run. They were 17 for two at tea on Friday.
Shoaib prised open the South African batting by taking the first two wickets and was a constant threat, bowling at high pace and exploiting a pitch which offered him steep bounce. He finished with four for 36 and was recorded at speeds of up to 150kmh.
The controversial bowler also hit South African all-rounder Shaun Pollock on the top of his left foot with a fast yorker. Pollock needed lengthy treatment on the field.
He was dismissed by Shoaib soon afterwards. Pollock did not take the field at the start of Pakistan's first innings but appeared shortly before tea.
Leg-spinner Danish Kaneria took three for 36 and Mohammad Asif two for 34 as South Africa crashed to their lowest total against Pakistan. The previous worst was 214 at Faisalabad in 1997/98.
Shoaib sparked the South African collapse when AB de Villiers tried to hook his 16th delivery and edged the ball to wicketkeeper Kamran Akmal. Then he had Hashim Amla, caught down the leg side off a glove.
Since his previous Test appearance against India in January last year, Shoaib, 31, has suffered from ankle and knee injuries and was banned from international cricket for using performance-enhancing drugs.
He was cleared by a Pakistani tribunal last month and joined the team in South Africa as cover for Umar Gul, who is recovering from an ankle injury.
Astonishingly, on a pitch which did not appear to have any demons, Pakistan put down four chances, none of which proved costly.
In contrast to the first Test, which South Africa won by seven wickets, Pakistan fielded a potent four-man bowling attack, with Shoaib and Mohammad Sami replacing Shahid Nazir and Rana Naved-ul-Hasan.
Kaneria came into the attack when Shoaib was rested after taking two for 17. Smith charged down the pitch and slammed the spinner's fourth ball past mid-off for four but was out for 28 off the next ball when he was deceived by a googly.
Akmal could not hold the chance but it bounced up for Younis Khan to catch it at slip.
Ashwell Prince was dropped by Akmal off Sami on two but was out four balls later, caught at first slip.
Kaneria had Jacques Kallis dropped at slip by Younis on 11 and Gibbs was dropped by Akmal off the next ball, only to miss a sweep off the next delivery to be leg before.
Kallis fell for 24 in Shoaib's second spell soon after lunch.
Mark Boucher made top score for South Africa with 35 before he top-edged an attempted sweep off Kaneria to slip.
Makhaya Ntini dismissed both openers before tea, with Imran Farhat edging a catch to third slip and Mohammad Hafeez caught off a glove at short leg when he tried to hook the fast bowler.
South Africa Ist innings 124 ( Mark Boucher 35, Graeme Smith 28, Kallis 24; Shoaib Akhtar 4 for 36, Kaneria 3 for 36, Asif 2 for 34, Sami 1 for 15) Vs Pakistan Ist innings 17 for 2 ( Mohd Hafeez 13; Ntini 2 for 5)