The 29-year-old battled back to take the contest to a deciding set, but he fell short in what was his third clay-court match of the year since recovering from an elbow problem.
Goffin required five match points to get over the line, claiming the scalp of another top seed by eventually prevailing 6-2 3-6 7-5 in a match lasting two hours and 40 minutes.
Djokovic lost serve in the opening game of the contest and struggled to truly hit back, with a second break in the fifth game giving his opponent a strong foothold on the match.
The second set proved to be a real battle, which the Serbian pro took with his fourth set point after Goffin - ranked 13th in the world - refused to give up.
Goffin's big chance looked to have eluded him when Djokovic earned a break of serve in the opening game of the deciding set, but the Belgian pegged his opponent back at 5-5 to pave the way for a tense finale.