Cape Town - Mominul Haque and Mahmudullah hit half-centuries as Bangladesh avoided the follow-on against South Africa on the third day of the first Test at Senwes Park on Saturday.
LIVE: Proteas v Bangladesh, Day 3
Mominul made 77 - the highest Test score by a Bangladesh batsman against South Africa - and Mahmudullah hit 66 as Bangladesh reached 308 for eight at tea in reply to South Africa's first innings total of 496 for three declared.
On a slow pitch, Bangladesh had four successive half-century partnerships between the third and sixth wickets.
Although South Africa were poised to take a substantial first innings lead, Bangladesh batted with positive intent and ensured that they would end a sequence of innings defeats in all their four previous Tests in South Africa.
The diminutive Mominul and fellow left-hander Tamim Iqbal saw off some hostile bowling by Morne Morkel and Kagiso Rabada at the start of the day, with the first nine overs producing only seven runs. Both batsmen survived close leg before wicket decisions against reverse-swinging deliveries from Rabada.
But 17 runs came off Rabada's fifth over of the day, including two successive boundaries by Mominul, and South Africa's change bowlers were unable to maintain the pressure.
The only wicket of the morning fell to new cap Andile Phehlukwayo when Tamim, on 39, glanced an off-target delivery down the leg side and wicketkeeper Quinton de Kock flung himself to his right to take a good catch.
Mominul was well caught at short leg by Aiden Markram off left-arm spinner Keshav Maharaj soon after lunch but Mahmudullah found another useful ally in Sabbir Rahman (30) before three wickets fell in quick succession in the last six overs before tea.