Joe Root hit 58 in England's second innings as the tourists set South Africa a mammoth target of 465 runs to save the final Test match.