The Spaniard made a triple-bogey 7 at No. 17, but then birdied the last for an 11-under 277 at Leopard Creek Country Club, two clear of Denmark's Thorbjorn Olesen and South African pair Charl Schwartzel and Anthony Michael.
Martin had surged ahead with an eagle-birdie start, and opened a five-shot lead through 11 holes following two more birdies on Nos. 7 and 9. With a three-shot lead on the tee at No. 17, the disastrous 7 then cut his advantage over playing partner Michael to one stroke with one hole to play.
But the 24-year-old defending champion recovered to send his second on the par-5 No. 18 to the middle of the green, and Michael found the water with his approach, after pulling his tee shot left, to end his chances.
Martin finished with a birdie four for successive victories at the European Tour's season-opening tournament, winning a $210,000 check. He is the first winner on the 2010-11 Race to Dubai and the first player to retain a European Tour title since Padraig Harrington won a second straight British Open in 2008.
''I played really well for nine holes, then I got myself into trouble,'' Martin said. ''It was a good start and it gave me a little bit of a cushion, and I needed it.
''I was able to hit a couple of good shots coming in, especially the one on 18. On 17 I made a big mess but I was really lucky that everything went well.''
Newcomer Michael, 25, had led since Thursday afternoon at Leopard Creek but had two bogeys and a double-bogey Sunday and couldn't match the attacking strokeplay of Martin.
Michael made a 15-foot putt for par on No. 18 to make sure of his share of second, but will have to wait for his first tournament win as a professional. Martin's final-round 73- his worst of the tournament - dropped him to 9 under alongside Olesen and the No. 39-ranked Schwartzel.
Martin made a blistering start when he almost holed his approach to the first and then sunk a 10-foot eagle putt at No. 2.
He got lucky on No. 13 when a wayward shot was held up by a bunker which prevented it disappearing into a crocodile-infested river.
On No. 17 he found a fairway bunker off the tee and then fired his second deep into the thick grass on the lip of the bunker. He ended up chipping out onto the fairway and then three-putted.
But he regained his composure with a 5-iron to the heart of the green on the last and collected a third career title after his 2009 win here and the 2007 Portugal Open - when he became the first amateur to win a European Tour event.
Denmark's Challenge Tour graduate Olesen fired a superb 66, with six birdies, to jump 10 places and into a tie for second with Anthony and Schwartzel.
Schwartzel mixed four birdies with two bogeys to finish with a 70 and secure the 2010 Order of Merit title on South Africa's Sunshine Tour, which co-sanctions the Alfred Dunhill, ahead of its season-ending 100th South African Open next week.
South Africa's Thomas Aiken (70) was alone in fifth on 7-under 281, while England's Robert Dinwiddie (70) and another South African, Alex Haindl (73), shared sixth with 282 totals.