South Africa 208 for 4 (De Villiers 95*, Behardien 35, Irfan 2-38) beat Pakistan 205 (Akmal 48, McLaren 3-32) by six wickets
Scorecard and ball-by-ball details

AB de Villiers racked up his third half-century of the series, in which he also scored a hundred, to guide South Africa to victory in their chase in Benoni with six overs to spare, sealing a 3-2 win for the hosts. De Villiers put in his best all-round performance in the decider, as he manned his chargers well and anchored the chase, albeit a modest one.

South Africa closed out the series largely due to Pakistan's inability to do the same, rather than being dominant. Apart from de Villiers' knock, the game changed in the space of four balls in the Pakistan innings when Shoaib Malik and Shahid Afridi both succumbed softly in the 35th over bowled by Ryan McLaren and abandoned the captain and lower order to nothing more than hope.

Malik and Afridi were guilty of poor shot-selection, they undid the work done by the batsmen before and left the lower order too much to do. They also did little justice to Pakistan's initial recovery after they found themselves in early trouble at 31 for 2 inside the first 10 overs.

Dale Steyn delivered a classic delivery to remove Mohammad Hafeez for the sixth time on this tour and take his 100th ODI wicket. Hafeez was forced to play at one that angled into him and then straightened and was caught at second slip. Imran Farhat followed shortly afterwards. After being worked over by Morne Morkel's awkward bounce, he edged a standard Lonwabo Tsotsobe delivery through to de Villiers.

An under-pressure Younis Khan had Kamran Akmal to thank for buying him some time and the pair built the best stand of the innings. Kamran peppered the area through point frequently to keep the score moving. Younis eventually settled and also brought up his 7000 ODI runs. The pair put Pakistan in a good position, but could not build on it.

Having slog-swept Robin Peterson for six successfully and with his half-century looming, Kamran tried it again but top-edged to hand a catch to McLaren. Two overs later, Younis mowed part-timer Farhaan Behardien to midwicket where Hashim Amla timed his jump to end what has been a lean series for Younis.

Shoaib Malik and Misbah combined to a produce a similar recovery in which they targeted Peterson and tried to be more conservative against the seamers. They stand grew to 47 when Malik did the inexplicable. He chipped a McLaren offcutter to midwicket to give Behardien catching practice. What Afridi did was even worse. He saw off two balls before picking the right one to pull but he singled out the fielder at deep square leg as well. With that, Pakistan's aims of reaching a competitive target ended.

McLaren scooped a third wicket for two runs when Misbah edged a slower ball, and Morkel pitched one up to have Saeed Ajmal playing on. Pakistan lost four wickets in 30 balls for 11 runs and it was left to the tail to get them to just over 200.

If they had any ambitions of defending that, they needed to make early inroads. In the first 11 overs, both Quinton de Kock and Colin Ingram played on to put the match back in the balance. Pakistan could have tipped the scale their way when Junaid Khan drew a thick outside edge from de Villiers, who was on 1, but Younis spilled a regulation chance.

De Villiers did not need a second invitation. He outplayed an uncertain looking Hashim Amla, who struggled against Ajmal and Afridi to underline the difficulties of the surface. Amla's scratchy 22 off 65 balls ended when he skied Mohammed Irfan while going for the pull.

As if to bellow out his intent not to give up, de Villiers hit the Afridi for six over long-on in the next over and there was little to stop him from there. He did not rely on too many big shots but ushered Behardien, and later David Miller, through tricky periods to seize control.

De Villiers' only jaw-dropping stroke was the deft guiding of an Irfan delivery between gully and backward point with an open-faced bat. The rest of innings was about grind, as expected on a pitch with inconsistent bounce. Even though runs were not free-flowing, his half-century came off 53 deliveries, he maintained a strike rate of over 80 and he took his average above 50 in ODIs.

Importantly, de Villiers seemed to settle in his treble role as captain, senior batsman and permanent wicket-keeper and that may be the most valuable thing South Africa take from their series win. They will also take heart from being able to triumph in a must-win situation. Pakistan cannot say the same. Since 2002, they have not won a deciding match in an ODI series and have never beaten South Africa in a bilateral ODI series.

Firdose Moonda is ESPNcricinfo's South Africa correspondent