The scores were 4-6, 6-3, 6-2.
The third-seeded Djokovic earned $55,500 for his second title of the year.
"I played this week the best tennis in my life," the 19-year-old Djokovic said. "This is the best feeling I can have. I win my second career title in my third final. I am having right now the best year in my career."
Djokovic, who last year won just 11 matches and finished 83rd, will enter the top-20 in the rankings next week.
Melzer entered the final on a 10-match winning streak dating back to his first ATP title in at the BCR Open Bucharest, Hungary, in September.