South Africa survived a late charge from Pakistan to pull off a thrilling one-wicket win and move closer to the semi-finals of the World Cup on Friday.
Aiden Markram hit a solid 91 and at 206-4 South Africa were well on course to comfortably chase down a 271-run target.
However, it was left to the last pair of Keshav Maharaj and Tabraiz Shamsi to score 11 runs while surviving 11 balls.
Shamsi survived a leg-before appeal that went to umpire`s call off fast bowler Haris Rauf with eight needed before Maharaj hit spinner Mohammad Nawaz to the square-leg boundary to pull off the win in 47.2 overs, sparking wild
celebrations in his team`s dressing room.
Maharaj (seven not out) also added 10 runs for the ninth wicket with Lungi Ngidi (four) but Rauf took a stunning catch off his own bowling to send Ngidi back.
The win took South Africa top of the table with 10 points from five wins in six matches.
Pakistan, however, have lost four in succession after opening the tournament with back-to-back wins.
They have four points and will need results to fall in their favour if they are to sneak into the semi-finals.
This was only the seventh one-wicket by a team in all World Cups and second by South Africa.
Left-arm spinner Shamsi took 4-60 in Pakistan`s 270 all out in 46.4 overs with 52 from Saud Shakeel, 50 from skipper Babar Azam and 43 from Shadab Khan.
Markram shone and with a 70-run stand for the fifth wicket with David Miller who scored a 33-ball 29 with two sixes and as many boundaries.
At that moment the Proteas seemed on course for a straightforward win.
But late drama unfolded at Chidambaram Stadium as Pakistan fought back as South Africa slipped to 250-8 from 206-4.
Shaheen Shah Afridi removed Miller in the 34th over while Rauf had Marco Jansen for 20 three overs later.
Markram hit three sixes and seven boundaries off 93 balls, his fourth fifty in the World Cup, also completing 2,000 ODI runs in his 61st match.
Earlier, it was Shamsi and Jansen who derailed Pakistan`s innings.
The 33-year-old leg-spinner finished with figures of 4-60 while pace bowler Jansen took 3-43 after Pakistan won the toss and batted, looking for a win to revive their World Cup hopes.
Pakistan would have scored fewer runs had Shakeel and Shadab not lifted them with an 84-run stand for the sixth wicket off 71 balls following Azam`s dismissal at 141.
Shadab hit two sixes and three boundaries while Shakeel`s second fifty in the tournament had seven hits to the rope.
It was Jansen who hit Pakistan early with the wickets of openers Abdullah Shafique (nine) and Imam-ul-Haq (12) in the first seven overs.
Azam added 48 runs for the third wicket with Mohammad Rizwan who made 31 with a six and four boundaries.
The skipper added another 43 for the next wicket with Iftikhar Ahmed who scored 21 with a six and a boundary.
Shamsi dismissed Iftikhar caught at long-on and Azam behind the wicket sweeping to derail the innings until Shakeel and Shadab rebuilt.
Fast bowler Gerald Cotzee broke the stand by dismissing Shadab in the 40th over while Shamsi sent back Shakeel and Shaheen (two).