JP Duminy's hat-trick and a much-needed half-century for Quinton de Kock carried South Africa to an easy nine-wicket win over Sri Lanka in the first World Cup quarter-final.

Bit-part spinner Duminy's first career treble even stole the spotlight from man of the match Imran Tahir's four for 26 as Sri Lanka were rolled for 133 at the SCG.

Opener De Kock had made only 53 runs in his previous six innings in the tournament, a tally he surpassed in this innings alone with 78 not out as his side took only 18 overs to chase their target.

Remarkably it was South Africa's first ever win in a World Cup knock-out match, as well as the biggest ever in terms of balls remaining.

Sri Lanka's elimination ends the one-day international careers of their stalwarts Kumar Sangakkara, who followed his four successive centuries in the tournament by top-scoring with 45, and Mahela Jayawardene. Both had already announced their retirement from ODIs, and Jayawardene from all international formats.

Sri Lanka won the toss and elected to bat, but only three runs were scored before Kusal Perera fell to Kyle Abbott thanks to wicket-keeper De Kock's stunning diving catch.

A single was chalked up before Tillakaratne Dilshan followed his fellow opener, edging Dale Steyn to Faf du Plessis at second slip for a duck.

Lahiru Thirimanne found the boundary five times and it was a big breakthrough for South Africa when Imran Tahir caught and bowled the left-hander for 41 runs off only 48 balls.

Jayawardene survived a Proteas appeal after lurching forward to block Tahir's googly but he was soon gone for just four runs when he presented a simple catch to Du Plessis off the same bowler.

At the halfway point of their innings Sri Lanka were 87 for four with Sangakkara cautiously chipping his way towards another score of substance, though Angelo Matthews fell to Duminy for 19.

Thisara Perera was removed for a duck in the next over by Tahir and Nuwan Kulasekara followed as De Kock pouched another Duminy delivery.

Sri Lanka were in free fall and Duminy completed his hat-trick by trapping Tharindu Kaushal plumb in front for a duck.

Sangakkara ignored the script and smashed two fours to reach 45 but promptly holed out to David Miller off Morne Morkel when attempting a cut.

All of a sudden rain forced a break in play and Sri Lanka added just six runs upon the resumption before Lasith Malinga slapped Tahir straight to cover.

Duminy told Sky Sports at the innings break: "I've never really come close to a hat-trick before so I'm pretty pleased with that. It's been a long time for me to contribute with the ball."

Proteas openers Hashim Amla and De Kock put on a rapid 40 before the former was caught in the deep by Kulasekara for 16, Malinga narrowly escaping a no-ball verdict.

De Kock had a difficult over against debutant spinner Kaushal in which he was beaten once and also almost gloved a catch to a close fielder, but he progressed to a 39-ball half-century.

A steepling leg-side shot was almost brilliantly caught by the diving Kusal Perera, who instead could only parry the ball into the boundary rope, and fittingly De Kock finished the job with his 12th four - three more than Sri Lanka managed as a team.

Sangakkara and Jayawardene were allowed to lead the teams off the field and captain Angelo Mathews paid tribute at the post-match presentation.

He said: "It's disappointing not to make it memorable for Mahela and Sanga but I take this opportunity, on behalf of the country and the team, to thank them for their invaluable service for 16 or 17 years.

"The best thing would have been to go on to the final for them but we'll try to find a way to make them smile.

"We really salute them and we thank them."