Bangladesh 167 for 3 (Sarkar 88*, Mahmudullah 50) beat South Africa 162 (du Plessis 41, Nasir, 3-26, Mustafizur 3-38) by seven wickets

Scorecard and ball-by-ball details

It has taken Bangladesh eight years and eight completed ODIs to record a second victory over South Africa, and it came with some added bonuses. Not only did Bangladesh square the series, they also secured their spot in the 2017 Champions Trophy. One of West Indies or Pakistan will miss out on the tournament but for now, it was South Africa who were left smarting.

It was South Africa's lowest total against Bangladesh and their lowest batting first in an ODI since November 2009, when they were bowled out for 119 by England. South Africa's batsmen were strangled by both seam and spin on a slow surface. By contrast, Bangladesh seemed to be batting on a totally different pitch and strolled to victory with more than 20 overs to spare.

Bangladesh book Champions Trophy spot Bangladesh are currently ranked seventh in ICC's ODI rankings, with Pakistan and West Indies below them. They have 94 rating points and have guaranteed their qualification for the 2017 Champions Trophy. If they lose the last ODI of the series, they will drop to 93 rating points, which will still be enough to ensure qualification because there is no scenario in which both Pakistan and West Indies can each achieve 93 rating points (unless more matches are added to the international schedule). The cut-off date for the qualification is September 30, 2015

The match was won by Bangladesh's attack, who displayed the discipline and guile that has seen them enjoy recent success over Pakistan and India. They frustrated the batsmen with tight lines, changes of pace and a slew of spin to keep the scoring rate down and force poor shot selection but had none of the same troubles themselves. With South Africa's attack failing to find the nagging length, Soumya Sarkar and Mahmudullah anchored the chase with a half-century apiece and a third-wicket stand of 135.

South Africa, in contrast, could not even manage a partnership of 30. Hashim Amla and Faf du Plessis combined for 29, after Quinton de Kock's uncomfortable stay at the crease ended when he was squared up by a Mustafizur Rahman delivery that popped up from a short length and took the shoulder of his bat on the way to Sabbir Rahman at backward point.

Amla worked his way to 22 which took him to the top of the averages list in ODI cricket, but could not work his way around Rubel Hossain, who uprooted his offstump with the first ball of his second over.

Rubel was recalled for this match and stepped up, with two maiden overs in succession to begin the drought. He operated in tandem with Shakib Al Hasan, who rushed Rilee Rossouw by pushing deliveries through flat and fast. The more Rossouw battled to get him away, the more the pressure built. By the time Nasir Hossain came on, Rossouw was confounded and missed a straight one to end an unconvincing knock.

That was the first soft dismissal; David Miller, Faf du Plessis and JP Duminy went the same way. Miller chipped Mahmudullah to short midwicket, du Plessis, who worked hard for his runs holed out to long-on and JP Duminy drove a Mustafizur offcutter to short cover.

Bangladesh were into South Africa's lower-order with 20 overs left in the innings, which gave Farhaan Behardien an opportunity to prove his worth. He batted with resolve, sought runs straight down the ground and ushered Chris Morris, Kagiso and Kyle Abbot through some tail wagging. Behardien's 36 pushed South Africa's score to some respectability but it was still a big ask for their bowlers.

Kagiso Rabada seemed up for it when he bowled Tamim Iqbal with his first ball - a fast, full delivery that the opener dragged onto his leg stump - and removed Litton Das' off stump in his next over. If Bangladesh were rattled, they did not show it.

Sarkar and Mahmudullah were confident, targeting Chris Morris who, like Kyle Abbott, often bowled too straight, and JP Duminy. Sarkar's half-century came off 47 balls, an indication that run-scoring was not as laboured as South Africa had made it look. Sarkar alone scored 13 fours and six; in their entire innings South Africa managed 14 fours and a six. Mahmudullah's fifty was harder work and came off 63 balls but his staying power meant Bangladesh did not have to worry about middle-order wobbles.

In a stamp of his authority on the match, Sarkar even took on Imran Tahir, South Africa's most threatening bowler, as the target was within sight. He sent two full tosses to the rope and then sealed the win with a slow-swept six to level the series 1-all going into Wednesday's decider.