Seemingly coasting towards a draw at 169 for three at tea after being set 363 for victory, England endured a dramatic collapse triggered by the run out of Kevin Pietersen.
Pietersen made 81 and added 145 for the fourth wicket with Jonathon Trott (69), but South Africa took the second new ball immediately after it was due, and debutant Friedel de Wet bowled his side to within touching distance of an improbably win.
The right-arm quick finished with four for 55 as England slipped sensationally from 205 for four to 218 for nine in the space of 68 deliveries, but Collingwood stood firm with an unbeaten 26 to deny the hosts victory.
The right-hander from Durham faced 99 deliveries and Onions saw off 12 as England staged a great escape act.
SCORE BOARD
SOUTH AFRICA (I Innings): 418 all out
ENGLAND (I Innings): 356 all out
SOUTH AFRICA (II Innings): 301/7 decl
ENGLAND (II Innings, O/n: 11/1):
Strauss c Boucher b Morkel 1
Cook c Smith b Harris 12
Anderson c Boucher b de Wet 10
Trott c de Villiers b de Wet 69
Pietersen (run out) 81
Collingwood (not out) 26
Bell c Boucher b de Wet 2
Prior c Boucher b de Wet 0
Broad c Boucher b Harris 0
Swann lbw Morkel 2
Onions (not out) 1
Extras (B-10, LB-3, NB-11) 24
Total (for 9 wkts, 96 overs) 228
Fall of wickets: 1-5, 2-16, 3-27, 4-172, 5-205, 6-207, 7-208, 8-209, 9-218.
Bowling: Ntini 18-6-41-0, Morkel 18-3-46-2, Harris 26-11-51-2, De Wet 23-8-55-4, Duminy 8-2-17-0, Kallis 3-1-5-0.
Deccan Herald is on WhatsApp Channels| Join now for Breaking News & Editor's Picks