Malan made 118 and Buttler scored 131 to enable England to pile up 346 for seven after being sent in.
It was a total which seemed unlikely when Lungi Ngidi took the first three wickets to reduce the tourists to 14 for three in the sixth over.
The left-handed Malan and his right-handed captain rebuilt the innings, slowly at first and eventually in a torrent of runs.
Their partnership was eventually worth 232 off 211 balls.
South Africa, holding a winning 2-0 lead in the series, opted to go into the match without their two fastest bowlers, Anrich Nortje and Kagiso Rabada, and appeared powerless to keep the scoring in check even after the two centurions were dismissed.
Ngidi took three for eight in a four-over opening spell but was expensive later on, finishing with four for 62. His last four overs cost 47 runs.
There were 19 sixes in the England innings, six of them by Malan, who faced 114 balls, and seven by Buttler, who faced 127 deliveries.