Struff peppered Djokovic with aggressive serving during a tense 2hr 35min slugfest.
After winning the opening set in a tie-break, with neither player dropping serve, Djokovic faltered on his own serve at 6-5 in the second set, allowing Struff to level the match.
The 24-time Grand Slam winner lost the decisive tie-break in the third set as Struff landed a first career victory over Djokovic after eight previous defeats.
The ATP Finals in Turin in November are reserved for the top eight players in the race rankings, excluding Jannik Sinner, who has withdrawn with a knee injury. The standings are based on results achieved during the current season.
Seven-time ATP Finals champion Djokovic currently occupies 11th place in the race but can take consolation from the defeat of ninth-ranked Spaniard Rafael Jodar, also eliminated in the second round in Basel by Monaco's Valentin Vacherot.
France's Arthur Fils, seventh in the race, defeated American Alex Michelsen 4-6, 6-3, 7-6 (5).
