Moeen Ali had previously savoured the delight of a hat-trick only during England’s football warm-ups and so was brimming with joy after his three-card trick wrapped up a convincing victory over South Africa and delivered a sensational finale to The Oval’s 100th Test match.

At 2.27pm on Monday afternoon England’s players erupted in celebration when the big screen showed Moeen had trapped the No11, Morne Morkel, lbw on review. He had removed Dean Elgar for a defiant 136 and Kagiso Rabada with the final two balls of his previous over.

In doing so he became the fourth bowler in history – and the first since Australia’s Lindsay Kline also against South Africa in 1958 – to seal a Test victory in such dramatic fashion, with Joe Root’s side completing a 239-run win that means they are 2-1 up going into Friday’s fourth Test.

“I’ve never taken a hat-trick in any sort of cricket. I’ve scored a few in football warm-ups but this is a different sort of feeling – and a better one,” said Moeen. He has 18 wickets in the series after becoming the first England spinner to claim a hat-trick for 79 years and the only man in Test history to do so against three left-handers.

Remarkably Moeen was the third England bowler in South Africa’s 252 all out to find himself on a hat-trick. Ben Stokes and Toby Roland-Jones also claimed two wickets in successive deliveries and it was the first Test innings in which there were four golden ducks.

England’s victory, following their 340-run defeat at Trent Bridge, was built on the efforts of this pair. Stokes was named man of the match for his 112 in the first innings, as well as three wickets and four catches, while the Middlesex seamer Roland-Jones claimed match figures of eight for 129 on debut.

Root’s side head to the series finale at Old Trafford with the Basil D’Oliveria trophy retained and have replaced Mark Wood with Steven Finn in their 13-man squad. Root heralded the efforts of his vice-captain, Stokes, saying: “He’s always been a great player but over the last year he’s really matured; he’s found ways to be more consistent and affect the game.

“Stokes is a person you know you can turn to under pressure. He works extremely hard, so hopefully he is still on an upward curve and there is more he can achieve in the game.”

Asked whether Roland-Jones could transfer his returns to Australia this winter after thriving in seamer-friendly conditions, Root replied: “He’s one Test into his career and it’s wrong to make assumptions now as to how he will fare in the future. He goes about his business in a very mature manner. He’s a very level-headed guy, he seems pretty calm out there in the field and it should stand him in good stead. You’ll only find out when he’s exposed to different conditions and situations.”

Root conceded it is hard to know which England side will turn up at Old Trafford, such has been their inconsistency over the past two years, but it is difficult to escape the fact they looked more balanced in this match.

Nevertheless England’s head coach, Trevor Bayliss, insisted the home side should not need Moeen coming in at No8.

Speaking on Sky, Bayliss said: “I’m still of the view we don’t need more than seven batters – we’ve got three guys like Stokes, Bairstow and Ali who give us a lot of options, so we looked at the conditions here and played the extra batsman. Roland-Jones and Tom Westley were outstanding. Westley [who made 59 at No3 in England’s second innings] fitted into the squad very easily and looks comfortable.

“Toby looks like one of his strengths is accuracy. We haven’t got the out-and-out pace that Australia have, so you’ve got to be able to put the ball in the right areas and Toby’s done that.”