The defending champion at the Sony Ericsson Open went into a funk after being warned for taking too much time between points, then blew a third-set lead to lose his opening match.
Qualifier Kevin Anderson, a 6-foot-7 former NCAA doubles champion at Illinois, beat the third-ranked Djokovic 7-6 (1), 3-6, 6-4.
Djokovic won his first Grand Slam title at this year's Australian Open and was coming off a title at Indian Wells last week. But he struggled from the start against Anderson and was rattled by the warning from the chair umpire.
Serving at 2-0 in the third set, Djokovic won the next point after the warning to reach deuce, then lost 13 points in a row. Jeers from the crowd further agitated him, and by the time Djokovic collected himself, Anderson was up a break at 3-2.
"I didn't focus myself in that moment," Djokovic said. "But, you know, that's OK. It's all part of the game."
Anderson, a big-serving South African, played for three years at Illinois and won the 2006 NCAA doubles title. He turned pro last year, and the victory was his first over a top-10 player.
"I kept telling myself, 'I can do this. I've just got to believe in myself,'" said Anderson, ranked No. 122. "Even still, just knowing what he's done and what a great player he is, to have beaten him is a tremendous experience for me."
In women's play, defending champion Serena Williams and top-ranked Justine Henin won their opening matches in straight sets.
Williams, seeking her fifth Key Biscayne title, reached the third round by beating Edina Gallovits 6-1, 6-2. Henin defeated Angelique Kerber 6-4, 6-2.
In other men's action, ninth-seeded James Blake defeated Andreas Seppi 7-5, 6-3. Seeded players had opening-round byes and were in action for the first time Friday.
Djokovic, leading 2-0 but facing break point, was dribbling before a serve when umpire Norm Chryst warned him for taking too much time. Djokovic whacked a forehand winner to end that point, then screamed in the umpire's direction and shook both fists. The crowd hooted at the Serbian.
Two points later, when Djokovic hit a first serve into the net, several fans cheers. He glared toward the stands, then lost the point and the game when he blew an easy volley.
Djokovic said he broke a shoelace during that rally.
"Obviously, the time violation and a lot of different things affected my service game," he said.