Spinner Keshav Maharaj bowled a six-run, two-wicket final over and South Africa held off Bangladesh by four runs to stay unbeaten in the Twenty20 World Cup.
Bangladesh needed 11 from the last six deliveries to register a famous win, and all-rounder Mahmudullah was just inches away from securing a famous victory off the second last ball.
With six needed from the final two deliveries, the Bangladeshi veteran smashed an ugly full toss to mid-on which would have cleared the rope, if not for a clean catch by South African skipper Aiden Markram.
Taskin Ahmed then came to the crease and faced the last ball, another full toss, but could only manage one run.
On a typically tough batting pitch at Nassau County Stadium, South Africa successfully defended its lowly total of 6-113 and restricted Bangladesh to 7-109.
It was the lowest target — 114 — ever defended in a T20 World Cup, trumping India's defence of 120 runs against Pakistan just the day before.
"That was not nice on the heart, but feels good that we got over the line," top-scorer Heinrich Klaasen, the player of the match, said.
"This wicket is not great for stroke play. We got some information from the last game and applied it today. I think we got a decent total on the board.
"We have had three pressure games now and I think we are through (to the next round)."
Maharaj finished with 3-27 in four overs, while Kagiso Rabada (2-19) and Anrich Nortje (2-17) also bowled well.
South Africa firmed top spot in Group D with three from three and was in pole position to secure a Super Eight spot. Bangladesh's first loss in two matches kept it in second place.
South Africa chased down Sri Lanka and the Netherlands in its previous two matches at the ground, and was made to bat first this time.
But it still fumbled another start. Pace bowler Tanzim Sakib trapped opener Reeza Hendricks for a golden duck and had Tristan Stubbs caught for a five-ball duck.
Markram was bowled for four. In between, Sakib bowled Quinton de Kock for 18 as the Proteas slumped to 4-23 in 4.2 overs.
David Miller came up with another rescue job after his half-century against the Netherlands. He scored 29 off 38 balls and put on 79 runs for the fifth wicket with Klaasen.
Klaasen top-scored with 46 off 44, including two fours and three sixes. The duo pushed South Africa past 100 before falling in the space of six deliveries.
The late strikes left South Africa hanging at just about a par total.
Bangladesh's chase faltered at the start, too. It was down to 3-37 and then 4-50 at the halfway stage.
Nortje dismissed skipper Nazmul Shanto for 14, and sent back Shakib Al Hasan for just three, picking up his eighth wicket in three games.
Litton Das was out caught off Maharaj, while Rabada had Tanzid Hasan caught behind for nine.
Towhid Hridoy and Mahmudullah put on 44 off 45 balls to bring Bangladesh back on track.
At 4-94 in the 18th over, Bangladesh was in the driver's seat then lost wickets rapidly to spiral out of control. It went from 4-94 to 7-108 in the space of 17 deliveries.
Rabada returned to trap Hridoy but Maharaj's left-arm spin turned the game in the final over.
South Africa completes the group stage against Nepal on Friday. Bangladesh has the Netherlands on Thursday.
Australia's next match will be against Namibia on Wednesday morning at 10.30am.
AP
Sports content to make you think... or allow you not to. A newsletter delivered each Saturday.