It was the first success in five years for the 41-year-old Oosthuizen, who started the final round tied with close friend Schwartzel, and was still level with him after play was suspended on Sunday because of heavy rain and the threat of lightning at Leopard Creek Country Club.
Oosthuizen and Schwartzel resumed their battle amid more heavy rain on Monday but Schwartzel immediately bogeyed the eighth hole, and again three putted on the 10th, to allow Oosthuizen to take the lead.
The 2010 Open winner, who hurt his arm on Friday, consolidated his advantage with birdies on the 11th, 13th, 14th and 15th holes to open up a three-shot lead with two holes to go.
But there was a sudden show of nerves as Oosthuizen bogeyed the 17th with a poor putt and then hit a wayward approach to the last but still managed to save par.
"I had a good run there at the end from the 13th through to the 15th and this was a tournament that I really wanted to win, it took me a while," said Oosthuizen, who brushed off his injury. "I'm managing it but it's fine," he said.
It is the fifth time that 2011 Masters champion Schwartzel has finished runner-up at Leopard Creek, having also won the tournament four times, three of them at the picturesque course on the border of Kruger Park. His final round 71 ensured a 272-round total.
The 2020 winner Christiaan Bezuidenhout finished third after returning a 68 in the last round for a total of 274.