Needing to make a world record 466 to win, South Africa were 90 for two at lunch.
Pieter Malan and Dean Elgar made a solid start for the hosts, putting on 39 for the first wicket and seeing their side through to the mid-morning drinks break. But Malan drove at the first ball after drinks and edged Woakes to Stokes at second slip after making 22.
Rassie van der Dussen was given out leg before wicket to Woakes in the same over but a review showed the ball was going over the stumps.
Van der Dussen went on to play some attacking strokes and dominated a second wicket stand of 50 with Elgar. He was 39 not out at lunch.
Elgar fell in the penultimate over before lunch after grinding out an innings of 24 of 73 balls. An attempted pull against Stokes looped off a top edge and provided the bowler with a simple catch.
England lead the series 2-1.