Top-ranked Novak Djokovic hummed on the baseline to keep himself calm as he survived an almighty scare against 110th-ranked Mischa Zverev to reach the Shanghai Masters semi-finals on Friday.

The defending champion, who has been struggling with motivation and injuries, lost the first set and was then taken to a second-set tie-break as tensions rose at the Qi Zhong Tennis Centre.

But qualifier Zverev's composure cracked as the 12-time Grand Slam-winner reeled off the first four points of the tie-break and raced through the deciding set to win 3-6, 7-6 (7/4), 6-3.

As Zverev became increasingly dispirited, Djokovic was a picture of calm as he hummed to himself during the deciding set to keep his mind off his mistakes.

"Instead of the occasional tantrum that I used to have, I hope it's behind me, so I would switch that vibration and transform it into a tune," said the world number one.

"I'm trying to remember, which one was it? It wasn't any mantra. It was a famous song, actually. I was using it to just forget about my mistake, previous mistake. And it worked, I hope," he smiled.

Djokovic's unusual tactic helped him avoid what would have been the most humiliating defeat of his season and maintained his record of reaching the semi-finals in all seven visits to the tournament.

It has been a troubled few months for the Serb, who said he had lost motivation and complained of "private issues" as he suffered shock early defeats at Wimbledon and the Olympics.


Pasta master

He now insists he no longer cares about titles or rankings points and is concentrating only on maintaining an "optimal state of mind", a process he compared to boiling pasta.

"(It's) like when you're trying to prepare pasta and then when it's boiling water, you just switch it down, you know, turn down the heat a little bit," he said.

"That's what you're trying to do but still keep the heat there, keep that focus, keep that momentum and trying to be in the zone and have that right intensity but just the right amount."

Andy Murray kept the heat on Djokovic's world number one spot as he thrashed Belgium's David Goffin 6-2, 6-2 to set up a semi-final against either Jack Sock or Gilles Simon.

Chinese fans brandished Serbian flags but there was consternation when three-time champion Djokovic gave up an early break and sent down four double faults as he lost the first set.

Djokovic's misfiring serve cost him another two breaks in the second set but he also broke Zverev twice as they went to a tie-break and the German stood on the verge of a famous win.

However, a succession of Zverev errors effectively handed over the set before Djokovic took control against the tiring German and saw out the victory in two hours and 20 minutes.

"It was the most entertaining match for me of the tournament, definitely. Had to dig out, dig myself out of the hole. He was the better player for most of the first part of the match," Djokovic said.

In the semi-finals on Saturday, Djokovic will play Spain's Roberto Bautista, who floored Jo-Wilfried Tsonga 6-3, 6-4 to send last year's runner-up crashing out.

Bautista broke Tsonga three times in the first set and once in the second as he raced through in 72 minutes for his third win in a row over the Frenchman.