Hashim Amla and JP Duminy guided South Africa to victory in an additional 30 minutes of play at the Basin Reserve, the latter firing the boundary that saw the Proteas ease past the 81-run victory target to 83-2.
Amla finished on 38 not out and the winning four gave Duminy an unbeaten 15 but it was a victory set up by their disciplined bowling unit, who had dismissed New Zealand for 171 in their second innings after tea.
While Mahraj took the spoils and the man-of-the-match award, it was, however, a first innings partnership between Temba Bavuma and Quinton de Kock that was the match-turning moment.
De Kock and Bavuma combined for 160 runs to rescue the Proteas on the second day, when the hosts had reduced them to 94 for six after they had scrapped to 268 in their own first innings.
The South African wicket-keeper counter-attacked to score 91 and was ably supported by Bavuma's 89.
Their partnership tired the New Zealand attack out to the point where Morne Morkel and Vernon Philander were able to produce a 57-run final wicket partnership that only ended on Saturday with the Proteas reaching 359 for a lead of 91.
Fast bowler Morkel then tore the top off New Zealand's batting line-up with the first three wickets.
Vernon Philander's nagging line and length and Kagiso Rabada's pace put the hosts under immense pressure that allowed Maharaj to attack on a wicket that was assisting turn but deliveries were not exploding off it.
Maharaj instead just kept floating the ball up, varying his pace and waiting for the impetuous shots from New Zealand's batsmen to come, which did at regular intervals.
Jeet Raval was the only batsman to provide any resistance as he was peppered by Morkel's bouncers and took several blows to his hands and body.
Raval, who survived three chances after he had passed 50, top scored with 80 before his dismissal to Maharaj after tea sparked a slump where New Zealand lost their last five wickets for 16 runs.
The real concern for New Zealand, however, will be to balance their approach against the pace trio and then face the slower bowlers, with even part-time off-spinner JP Duminy taking a career-best 4-47 in the first innings.
South Africa have also called in off-spinner Dane Piedt for what are expected to be spin-friendly conditions in the third Test at Seddon Park in Hamilton, starting on March 25.
268 & 171 in 63.2 overs (Maharaj 6/40, Morkel 3/50) lost to South Africa
359 in 98 overs (De Kock 91, Bavuma 89) & 83/2 in 24.3 overs (Amla 38*, Elgar 17) by eight wickets