South Africa take a 2-1 lead in the five-match one-day series with a 34-run victory against Pakistan who fell short after a thrilling chase in the third ODI at The Wanderers.
Pakistan were bowled out for 309 in 48.1 overs after South Africa put into bat rattled up a mammoth 343 for five.
Shahid Afridi kept Pakistan in the hunt with a vintage knock of 88 off 48 balls with seven sixes and five boundaries.
But his dismissal in the 35th over virtually ended their faint hopes of chasing down the massive target despite Wahab Riaz holding the tail with 45 off 52 balls smashing five boundaries and a six before being last man out.
Despite losing Nasir Jamshed early, Hafeez put them back on track with 57 off 49 balls hitting six boundaries and three sixes.
Kamran Akmal (30) figuring in a 82-run stand for the second wicket with Hafeez who was third out in the 20th over with the total on 111.
Skipper Misbah ul Haq (below) hit a quickfire 28 off 25 balls with four boundaries during an enterprising 72-run stand for the sixth with Afridi who virtually single-handedly took Pakistan to the brink of victory with a memorable knock.
But he was stopped in his tracks by Tsotsobe who deceived him with a slow bouncer to hole out to McLaren in the deep after having struck two consecutive boundaries in the 36th over.
Thereafter it was all over bar the shouting.
Ryan McLaren who bowled Afridi off a no ball claimed three for 56 and Tsotsobe three for 74.
Peterson snared two for 51 while Kleinveldt and Steyn picked up a wicket apiece.
"I'm really pleased with the way everybody played. The way we played today, it showed we can be a good chasing side," said Pakistan captain Misbah ul Haq.
I'm proud of the way we fought back. I told the boys in a huddle when we got a couple of wickets at the other end, 'we cannot get ourselves down when a guy like Afridi is playing like this'," said South African skipper AB de Villiers.
Amla and AB de Villiers shared the man of the match for their world record partnership for the third wicket of 238 in 194 balls.
"We had a great atmosphere, batting up front was a little difficult, when AB came in we got some rhythm," said Amla who made 122 off 113 balls with nine boundaries and a six.
AB de Villiers top scored with a hurricane knock of 128 off 108 with 12 fours and three sixes.
Faf du Plessis also played a crucial hand in their huge total as they posted 153 runs in the last 15 over.
His brilliant cameo of 45 off just 19 balls contained four boundaries and three sixes.
Pakistan for their part were handicapped by the absence of Mohammad Irfan who claimed two for 34 from seven but could not continue on the field suffering from an illness.
He rocked the hosts by removing Graeme Smith with the first 10 Powerplay producing just 26 runs, the lowest by South Africa.
South Africa were reduced to 42-2 by the 15th over before the Amla-de Villiers show began.
"It was a special knock. We got down on ourselves but I told the guys we were seeing something special," said de Villiers of Afridi's onslaught, which included a six that cleared the grandstand.
Once Afridi departed with Pakistan still 99 runs short, it proved too big a target.
South Africa, who played in a pink uniform to raise awareness of breast cancer, lead the five-match series 2-1 with games to come in Durban on Thursday and Benoni next Sunday.
Pakistan have called up left-arm pace bowler Sohail Tanvir as cover for Umar Gul and Mohammad Irfan, who have fitness issues.
"He was already in South Africa so he was asked to join the team as a cover for Gul and Irfan who are unfit," chief selector Iqbal Qasim told Reuters.
Irfan bowled seven overs on Sunday but limped off the field after aggravating a hamstring strain. Gul did not play.
Pakistan are all out for 309 in 48.1 overs having been set a target of 344 by South Africa in the third one-day international at the Wanderers on Sunday.
Kleinveldt bowls Wahab Riaz with a yorker which knocks the leg stump over in the 49th over.
Riaz made 45 off 52 balls hitting five boundaries and a six.
Riaz square drives McLaren to backward point for a boundary in the 48th over.
Junaid Khan has attacked Kleinveldt smashing him to long off to begin the 46th over to bring up the 300 of the Pakistan innings.
Riaz has pulled Steyn to midwicket for his fourth boundary.
Riaz has picked up another useful boundary off McLaren scooping it over fine leg.
Kleinveldt takes a low catch at mid off to dismiss Saeed Ajmal off McLaren having made eight off 15 balls.
Riaz has pulled Kleinveldt over long on for his first six in the 40th over as Pakistan stay in the hunt.
Riaz has smashed Kleinveldt through extra cover for his first boundary in the 38th over.
Afridi miscues a full toss from Tsotsobe to be held by McLaren in the deep after having struck two consecutive boundaries in the 36th over.
Afridi (below) departs after making a 48-ball 88 with seven sixes and five boundaries.
McLaren has gone for 19 in a drama filled 35th over in which he bowled Afridi off a no ball and was hammered for two sixes and a boundary.
Afridi continues his fireworks hammering McLaren out of the ground for his seventh six.
Ryan McLaren has bowled Afridi but it was off a no ball having overstepped and Pakistan get a free hit.
Afridi smashed a boundary over square leg and towering six over midwicket off McLaren.
Afridi has smashed a six over long off and a boundary to square leg off the first two balls of Tsotsobe in the 34th over.
Pakistan managed to get 46 for the loss of Misbah in the batting Powerplay overs to keep abreast of the asking rate.
Misbah is out caught behind by AB de Villiers backing away and getting a thin edge slashing at a delivery from Ryan McLaren.
The Pakistan captain made 28 off 25 balls having hit four boundaries after having added 71 runs in 48 balls for the sixth wicket with Afridi.
Afridi reached his 34th ODI fifty and fourth against South Africa off just 31 balls.
It was his first half century since September and contained four sixes and one boundary.
Afridi hits a boundary with a top edge over fine leg and towering six over square leg off Kleinveldt in the 31st over in which Pakistan get 17 runs.
The 50 partnership for the sixth wicket between Misbah and Afridi comes in 36 balls.
Steyn gives away only five runs in the 30th over.
Rory Kleindveldt bowls the 29th over and 15 runs come off it.
Misbah hits inside out through extra cover for a boundary.
Afridi gives room and smashes the second ball from Kleinveldt over long off for a six.
Pakistan are taking the batting Powerplay from the 29th over with the total 158 for five.
Steyn has been brought back into the attack with Afridi on the rampage.
Afridi has whacked a couple of sixes in consecutive deliveries off Tsotsobe over square leg and long on into the second tier to keep alive Pakistan's hopes.
Misbah has swept Peterson twice in consecutive deliveries to the square leg boundary.
Pakistan are crumbling having lost half their wickets for 133 at the halfway stage of the innings.
Shoaib Malik is deceived by a slower delivery from Tsotsobe driving straight to Kleinvedlt at midoff after 12 balls for four.
Younis Khan is bowled off an inside edge by Peterson for 19 off 20 ball having hit two boundaries.
Hafeez holes out to long off where Steyn holds on to well judged catch off Peteson for 57 off 49 balls having hit six boundaries and three sixes.
Ryan McLaren strikes in his first over having Kamran Akmal caught behind by AB de Villiers.
Akmal gets a thin edge attempting to uppercut a slow bouncer to depart for 30 off 42 balls having hit four boundaries.
His second wicket partnership with Hafeez was worth 82 runs off 76 balls.
Hafeez has raced to his 16th ODI fifty and third against South Africa off 41 balls by thumping two consecutive sixes off left arm spinner Robin Peterson over long-on and midwicket.
His half century also contained six boundaries.
Hafeez has hit a bouncer from Kleinveldt over fine leg getting a top edge to send the ball sailing for a six.
Kamran swings Kleinveldt to midwicket to bring up the 50 partnership while Hafeez hits another boundary back past the bowler.
The 50 of the Pakistan innings has come off 9.3 overs with Hafeez getting a boundary to fine leg off an inside edge of Tsotsobe.
Hafeez has pulled Steyn through midwicket for another boundary as Pakistan make a positive start.
Kamran has slammed a short pitched ball from Steyn over mid off for his second boundary.
Kamran Akmal has cracked Tsotsobe square of the wicket on the off for his first boundary.
Hafeez gets his first boundary via a thick outside edge to third man off Steyn whom he drives through cover for another two balls later.
Jamshed goes failing to clear midoff where Amla pockets a comfortable catch off Tsotsobe.
Jamshed made 10 off 14 balls hitting a boundary and a six.
Jamshed has hit the first six of the Pakistan innings flicking Tsotsobe over square leg to reach 1,000 ODI runs.
Jamshed hits the first boundary of the Pakistan innings cracking Lonwabo Tsotsobe over extra cover in the second over.
Dale Steyn begins the Pakistan innings with a maiden to Nasir Jamshed as they began chasing the mammoth target of 344.
South Africa make 343-5 in their 50 overs having been put into bat by Pakistan in the third one-day international at the Wanderers on Sunday.
Whirlwind centuries by Hashim Amla (122) and AB de Villiers (128) during a world record third wicket stand of 238 against Pakistan helped South Africa make 343-5 in 50 overs in the third one-day international at the Wanderers on Sunday.
Pakistan were handicapped by sickness to Mohammad Irfan who reduced South Africa to 42 for two by the 14th over dismissing Graeme Smith and Colin Ingram.
But AB de Villiers led the way with a remarkable knock smashing 112 fours and three sixes to make 128 off 108 balls.
Amla also matched him almost stroke for stroke hitting nine boundaries and a six during his knock of 122 of 113 balls.
The pair pulverised the Pakistan attack with their 238-run stand requiring just 194 balls and containing 18 fours and four sixes.
South Africa plundered 150 runs in the last 15 overs.
Faf du Plessis bludgeoned 45 off just 19 balls with four boundaries and three sixes to swell the South African total.
Irfan had the best return of two for 34 from his seven before retiring sick while Wahab Riaz was the most expensive with his two wickets costing 93 runs.
Saeed Ajmal also went for 62 for one wicket in his 10 overs.
Afridi's seven overs went for 55 while Hafeez conceded 49 from six.
SOUTH AFRICA INNINGS
Faf du Plessis was out in the penultimate ball of the innings caught by Younis Khan off Riaz having whipped him over fine leg for a six in the first ball of the over.
Faf du Plessis has sent Junaid Khan crashing through the covers for his 14th boundary in the 49th over.
Faf du Plessis has taken Riaz to the cleaners in the 48th over which goes for 20 runs, smashing a couple of sixes straight and over midwicket in addition to two boundaries.
AB de Villiers' remarkable innings comes to an end in the 47th end top edging a slog sweep off Ajmal to Malik who takes a skier.
The South African captain made 128 off 108 balls with 12 fours and a six.
AB de Villiers clubs Junaid Khan for another boundary to midwicket to bring up the 300 of the South African innings in the 46th over.
The last ten overs from the 36th have produced 103 runs with AB de Villiers and Amla were on the rampage with the batting Powerplay overs yielding 53 runs.
Amla spoons a catch to Misbah at extra cover off Riaz as a wonderful innings and world record partnership comes to an end.
Amla, who got a life on 36 when he was dropped by Hafeez, made 122 off 113 balls having hit nine boundaries and six.
His partnership of 238 with AB de Villiers is the highest for the third wicket eclipsing the previous highest of 237 between Tendulkar and Dravid made against Kenya in 1998.
Their partnership which came off 194 balls contained 18 fours and four sixes.
AB de Villiers and Amla smashed a couple of sixes off Afridi who goes for 18 in the 41st over.
AB de Villiers completed his 14th ODI century and second against Pakistan by cutting Afridi to third man.
His century which came off 87 balls contained 11 fours and a six.
It also brought up the 200 partnership for the third wicket off just 167 balls.
Hafeez goes for 19 in the 39th over as AB de Villiers hits a boundary and two consecutive sixes over square leg and extra cover.
Amla completed his 11th ODI century and second against Pakistan off 99 balls with seven boundaries.
AB de Villiers brings up the 200 of the South African innings with a cheeky scoop to the fine leg boundary off Riaz in the 37th over.
AB de Villiers and Amla have surpassed the previous highest partnership of 137 for the third wicket set by AB de Villiers and Herschelle Gibbs against Pakistan.
Pakistan are down to 10 men once again.
Irfan is on his knees struggling to stay up with the umpires refusing a substitute earlier.
AB de Villiers has swept Afridi over short fine leg for his seventh boundary as the South African is ticking along merrily.
Junaid Khan's seventh over on his returns proves to be expensive going for 13 runs with Amla turning it off his pads to finish it with a boundary.
South Africa are on a roll now with their third wicket partnership prospering while AB de Villiers gets another boundary steering Junaid Khan with exquisite timing to third man.
Amla dances down the track and lofts Saeed Ajmal to the long off boundary as the 150 of the South African innings comes in the 30th over.
The 100 partnership for the third wicket between Amla and de Villiers comes off just 89 balls.
AB de Villiers hits hits fourth boundary off Hafeez to complete his 31st ODI half century and seventh against Pakistan which came off just 47 balls.
AB de Villiers has hit his fourth boundary with a reverse sweep off Hafeez.
AB de Villiers and Amla are rotating the strike running their singles quickly.
Amla completed his 20th ODI half century off 53 balls having hit four boundaries.
Pakistan are attacking with all out spin as Afridi has been introduced followed by Hafeez.
AB de Villiers hammers a boundary off Afridi's first over through extra cover.
Amla (below) is living dangerous getting an inside for another boundary off Riaz.
Amla (36) has been dropped by Hafeez at backward point off Riaz who was smashed for a boundary in the previous through point.
AB de Villiers has sent an overpitched delivery from Irfan crashing to the cover boundary.
AB de Villiers has hit his first boundary swinging Riaz to fine leg to bring up the 50 of the South African innings in the 15th over.
Irfan strikes again in his sixth over dismissing Ingram caught behind for 17.
Ingram faced 43 balls and hit two boundaries during his knock adding 38 runs for the second wicket with Amla.
Irfan has bounced him out with a nasty delivery which Ingram could only fend to Kamran Akmal who took the simplest of catches.
Wahab Riaz is into the attack now replacing Irfan who dismissed Smith.
Junaid Khan bowls a second maiden as South Africa's total of 26-1 is their lowest in the Powerplay overs.
Khan has excellent figures of 5-2-3-0 while Irfan's figures read 5-1-22-1.
Amla has flicked another one from Irfan to backward of square leg.
Amla has got his first boundary with an exquisite cover drive off Irfan in the seventh over.
Colin Ingram has hit the first boundary of the South Africa with a perfect carpet drive on the off past Irfan.
Irfan knocks back Smith's middle stump being bowled off an inside edge in the third over of the match.
Smith faced 11 balls for three runs as Pakistan jolt South Africa.
Pakistan off to a terrific start putting South Africa under pressure with two consecutive maiden overs.
Hashim Amla is ruled out leg before off Junaid Khan but South Africa overturn the decision with a successful referral with the ball having pitched outside leg.
Mohammad Irfan begins with a maiden over to Graeme Smith.
Pakistan have won the toss and decided to bowl in the third one-day international against South Africa at the Wanderers on Sunday.
The series is tied at 1-1 with South Africa winning the first match by 125 runs while Pakistan bounced back to win the second by six wickets.
Mohammad Irfan was the star of the rain-affect 44 overs a side match taking a career-best four for 33 while Misbah ul Haq powered his side home with an unbeaten 57.
Umar Gul is out with a knee injury and Wahab Riaz is in for Pakistan while for South Africa, Kyle Abbott is out and Rory Kleinveldt is in.