At tea Maharaj was the best of the South Africa bowlers with 3-82 while Vernon Philander had 2-48 and Morne Morkel, a little down on pace in his first test in more than a year, had 2-56.
His century had come in 315 minutes from 195 deliveries with 18 fours and he was out when New Zealand was 277-6.
With the game evenly poised after an absorbing first three days, both sides were hoping looming rain over the weekend did not dictate the outcome.
South Africa lost opener Stephen Cook for a duck in the first over of their second innings and, despite a 20-minute delay when the University Oval was evacuated after a fire alarm in the main grandstand, they survived without further loss until bad light stopped play.
South Africa will resume at 229 for four this morning at University Oval in Dunedin after skipper Faf du Plessis won the toss and chose to bat.
New Zealand are in a healthy position to take control of the opening Test against South Africa after closing day two at 177-3.
Earlier, New Zealand dismissed South Africa for 308 just after lunch.
Before this match he had taken 32 New Zealand wickets at an average of 15.33, a lot of them taken on New Zealand soil. Wicketkeeper B.J. Watling made 50 - his 13th half century in tests and his third in seven test innings against South Africa - and Neil Wagner blasted 32 to push New Zealand beyond the Proteas' total.
The hosts had taken four wickets in the first session with Dean Elgar falling for 140, while Temba Bavuma was dismissed for 64 after the pair had combined for a 104-run partnership.
Yet, in an era where spectators (and even some players) look for instant satisfaction, this match is a throwback to a previous age.
He was aided by the injured Ross Taylor (15 not out), who was forced from the field by a calf tear earlier in the innings but returned to join Wagner and smashed as a six as he helped add 17 for the last wicket, despite being barely able to run.
Official denies son of Kim Jong-nam is in Taiwan
On Tuesday, Malaysia barred all North Koreans in the country, including diplomats and embassy workers, from leaving. Han Sol's father Kim Jong Nam was assassinated at Kuala Lumpur International Airport in Malaysia in mid-February.
Meet the Trumps: First Lady Melania opens White House doors
President Donald Trump reopened the White House to public tours on Tuesday, and greeted the first group of visitors personally. The tour group, many of whom were 5th grade students from Briarwood Christian School in Birmingham, Ala., cheered.