Madsen shot a 67 for a 19-under total of 269 and a two-shot victory, overtaking Schwartzel and Hennie Otto of South Africa.
Schwartzel had a triple-bogey 6 on No. 6 and a double bogey on No. 10 to lose his overnight lead. Otto, the 2011 champion, lost the lead when he bogeyed the 15th hole and had a double bogey on the 16th.
Madsen had five birdies and no bogeys.
"I expected to play well, but I didn't expect to stand here," he said during the trophy presentation.
Madsen was ranked No. 244 in the world before the tournament.
Jbe Kruger shot a final-round 65 to tie Otto for second at 17 under. Marco Crespi and Schwartzel tied for fourth at 16 under.