South Africa overcame a testing start to defeat Bangladesh by nine wickets at the Wanderers, taking command through Marques Ackerman's century and Simon Harmer's decisive six-wicket haul.