Allrounder Andile Phehlukwayo made a key breakthrough to stop Bangladesh's most threatening challenge on their tour of South Africa in the first Twenty20 international at Mangaung Oval on Thursday.
South Africa won by 20 runs after scoring 4-195 but opening batsman Soumya Sarkar went on a ferocious assault at the start of the Bangladesh innings before falling to Phehlukwayo for 47.
Bangladesh the lost momentum and finished with 9-175.
"We knew they would come out with guns blazing," said stand-in South African captain JP Duminy.
"But the guys stayed calm and backed their skills and their variations."
Sarkar (47 off 31) and Imrul Kayes (10) put on 43 off 25 balls for the first wicket and although the tourists lost two wickets they were still in with a chance with the total 2-92 when Phelukwayo struck with the first ball of the 10th over.
Phehlukwayo successfully sought a review after Sarkar was initially given not out after being struck on the pads after a spectacular innings during which he hit five fours and two sixes.
Phehlukwayo also claimed the wicket of Mahmudullah in a four-over stint in which he conceded only 25 runs.
South Africa had two key partnerships. Quinton de Kock (59) and man of the match AB de Villiers, who made 49 off 27 balls, put on 79 off 51 balls for the second wicket before Farhaan Behardien (36 not out) and David Miller (25 not out) thrashed an unbeaten 62 off the last five overs.
Bangladesh fought back in the middle overs. Rubel Hossain bowled an outstanding 15th over in which he conceded only three runs and took the wicket of de Kock.
Off-spinner Mehedi Hasan took the first two wickets and conceded a respectable 31 runs in his four overs.
"We pulled it back in the middle overs but the last five overs cost us the game," said Bangladesh captain Shakib Al Hasan. "Then we made a great start but didn't capitalise. For the first 10 overs we were right in there."
The sides meet in the second and final Twenty20 international in Potchefstroom on Sunday with Bangladesh hoping to salvage some pride after being blanked in the Test and ODI series.