Schwartzel, who had led since the halfway point, overcame sickness and shoulder and back pain to finish at 19-under 265 for the tournament at the Club de Campo golf course.
The 24-year-old got two early birdies to pad his overnight lead of one shot, and another three after the turn.
Schwartzel's previous European Tour victory came in last year's Spanish Open.
"I woke up this morning and felt a lot better than I have been feeling," he said. "I thought I ground it out nicely all week. I just managed to keep it going today."
Gonzalez, who shot a 62 on Saturday, posted a final-round score of 68 and finished at 16 under.
Pablo Larrazabal (67) placed third at 15 under, one better than fellow Spaniard Alvaro Quiros (64) and England's Robert Rock (64).