Ben Stokes was driven by a desire to make his father proud as he shrugged off injury niggles to inspire England to a dramatic final-day victory over South Africa in the second Test at Newlands.

England prevailed by a comfortable-looking margin of 189 runs, but only after vice-captain Stokes - whose dad, Ged, was hospitalised in Johannesburg with a serious illness on December 23 - claimed three wickets in the last hour of play to extinguish the hosts' hopes of salvaging a draw.

With attack leader James Anderson hampered by an apparent side problem, Stokes stepped up with a stunning spell of 3-1 from 4.4 overs, dismissing Dwaine Pretorius, Anrich Nortje and Vernon Philander in quick succession.

The all-rounder's brilliant burst rounded off a superb individual display. After making 47 in England's first innings, he took five catches in South Africa's reply and then gave the tourists crucial additional time to chase victory by blasting 72 from 47 balls.

After his latest match-winning heroics, Stokes - the hero of his country's Cricket World Cup win and Headingley Ashes victory last year - said his father, who spent several days in intensive care following his admission to hospital, had been in his thoughts throughout.

"I don't want to get into it too much, but obviously with everything that's happened with my dad and stuff like that, you have a bit more inside of you and the niggles and the injuries and stuff like that just sort of go," Stokes told Sky Sports.

"I know I always wear this shirt with the most amount of pride that I possibly can running into bowl, but there was a bit more there for me this week.

"And you know, bad knee, bad side or whatever it was, I always had my dad in the back of my mind, thinking about where he was. I haven't managed to speak to him tonight but I hope I've made him proud."

England's win levelled the four-match series at 1-1 ahead of next week's third Test in Port Elizabeth.