The defending champion rarely looked comfortable against his pumped-up German opponent, but fought back from a set down to eventually triumph 3-6 7-6 6-3 in two hours and 20 minutes.
The match statistics told their own story -- Djokovic made 37 unforced errors, landed only 53% of his first serves and had six double faults.
Afterward, he appeared agitated and seemed to claim a cameraman was too close to him before walking off court without giving the customary post-match interview.
While the 29-year-old has been the dominant force in men's tennis the past two years, his form has suffered in recent months.
Djokovic won the first two majors of the year in Australia and France but has complained of injuries since then and spoke recently about his need to learn how to enjoy tennis again
after triumphing at Roland Garros and completing his collection of grand slam titles.
Djokovic did make the US Open final in September after benefiting from three walkovers, but was then defeated by Stan Wawrinka.
His semifinal opponent Saturday, as he seeks to win his fourth Shanghai title in the past five years, will be Spain's Roberto Bautista Agut.
The 15th seed -- who has lost all five career meetings with Djokovic, including two this year -- beat French ninth seed Jo-Wilfried Tsonga 6-3 6-4 earlier Friday.
World No. 2 Andy Murray also progressed to the last four, thrashing Belgium's David Goffin 6-2 6-2. The Brit, champion here in 2010-11, will next play either American Jack Sock or France's Gilles Simon.
Zverev had been hoping for his first win over a top-10 player since 2010, when he beat sixth-ranked Nikolay Davydenko in Shanghai.
The 29-year-old was involved in controversy during this tournament when his second-round opponent Nick Kyrgios appeared to give up during their match, and had an angry exchange with fans who booed him.
The Australian was subsequently fined $16,500 by the ATP
after being charged for a "lack of effort," unsporting conduct and verbally abusing a spectator.
Meanwhile, Angelique Kerber suffered a blow in her hopes to win the year-end world No. 1 ranking after losing in the quarterfinals of the Hong Kong Open.
The German reached the final last year, but exited the tournament after Friday's 6-3 6-1 defeat to 38th-ranked Australian Daria Gavrilova.
US Open champion Kerber
will now focus on the season-ending WTA Championships in Singapore. World No. 2 Serena Williams has yet to confirm she will return for the event, having not played since Flushing Meadows.