Martin took 5-37 as South Africa were bowled out for 186 in reply to New Zealand's first innings total of 119. New Zealand were 40 for two at lunch, a deficit of 27.
South Africa started the day in a strong position at 133 for four but lost their last six wickets for 53 runs as the pitch again provided plenty of assistance to the pace bowlers.
Only a hard-hit 32 not out off 19 balls by Shaun Pollock prevented a complete rout of the South African lower order batting.
The collapse started in the third over of the day when left-armer James Franklin had AB de Villiers caught at second slip for two. Five balls later he trapped Mark Boucher leg before for nought.
Martin struck with the fifth ball of the next over when Ashwell Prince was caught behind for four.
He followed up with the wickets of Andrew Hall and Dale Steyn, while Pollock went for his shots, hitting two sixes and three fours. Pollock and Makhaya Ntini added 25 for the last wicket before Ntini was caught behind off Kyle Mills.
It was Martin's seventh five-wicket haul in Tests.
New Zealand opening batsman Jamie How, out for nought in the first innings, was dropped at fine leg by Steyn off Ntini when he had one but was out for four in the next over, leg before to Steyn.
Michael Papps was caught at second slip off Jacques Kallis for 15 in the last over before lunch, leaving New Zealand captain Stephen Fleming unbeaten on 13. Fleming survived a difficult chance to De Villiers at third slip off Ntini when he had six.