The lanky Jansen took a career best 7-13 as Sri Lanka were all out inside 14 overs as 19 wickets fell on a lively surface at Kingsmead on Thursday.
South Africa, put in to bat and 80-4 overnight, were bowled out for 191 by lunch in their first innings but were on 132-3 in their second as they chase victory to stay on track for a place in the World Test Championship final at Lord's next June.
Jansen, 24, is only the second bowler to take seven wickets inside seven overs of a test innings, emulating former Australia captain Hugh Trumble, whose 7-28 in 6.5 overs, including a hat-trick, bowled them to victory over England in Melbourne in 1904.
Jansen’s haul also took only 41 balls after clean bowling three Sri Lankans, having three more caught in the slips and finishing off the innings with a caught and bowled as last man Asitha Fernando struck a delivery high into the sky.
“We saw the ball was moving around earlier in the day and knew that if we put it in the right area, we could make things happen," said Jansen.
Sri Lanka's score was the tied-ninth lowest innings in test history and their own worst total by 29 runs after their previous low of 71 against Pakistan in Kandy 30 years ago.
It was also the lowest test innings total at the Durban venue, eclipsing the 53 scored by Bangladesh in March 2022.
Gerald Coetzee took 2-18 and Kagiso Rabada the first wicket on a seamer-friendly surface that gave the home attack plenty of assistance but with the Sri Lankans contributing to their rapid demise with some shocking batting.
Kamindu Mendis top scored with 13 runs while five players were dismissed without scoring.
Home captain Temba Bavuma top-scored with 70 runs in South Africa's first innings, returning after missing last month's two-test series victory in Bangladesh with an elbow injury, and was 24 not out at stumps along with Tristan Stubbs on 17.
Aiden Markram scored 47 in South Africa’s second innings before being bowled by Vishwa Fernando while Prabath Jayasuriya took two wickets to reach 100 in his test career in only 17 tests and become the joint second-quickest to a ton of wickets.