SHANGHAI — Novak Djokovic certainly appears to be a different player on court these days: Smiling after shanking balls instead of screaming, humming songs instead of hurling rackets.

And that’s when he’s having an off day.

Djokovic was sluggish and error-prone early in his quarterfinal match against Mischa Zverev at the Shanghai Masters on Friday, but he maintained his composure and fought back to win 3-6, 7-6 (4), 6-3.

The top-ranked Serb has said in recent weeks that he’s trying to find more balance in his life and reduce some of the pressure he’s felt on court this season. Part of that entails staying calmer during matches, particularly when things aren’t going well.

In the first set against Zverev, things couldn’t have gone much worse. Djokovic piled up 18 unforced errors to only four for Zverev, a German qualifier ranked 110th, and connected on less than half of his first serves.

He started to find his game in the second set, but Zverev continued to press him with his serve-and-volley style, forcing more miscues.

“I wasn’t striking the ball very well,” Djokovic said. “I was quite flat with my feet, so he got me where he wanted to get me, and to stand still at the baseline.

“(Zverev) was fighting. He was focused. He gave his best, and he was a few points from winning.”

Despite his rash of unforced errors — he finished with 37, including six double-faults — Djokovic didn’t glower at his coaches in the stands or scream at himself. Not once.

Instead, he hummed a little song.

“It was toward the end of the match,” he said of his musical interlude. “Instead of the occasional tantrum that I used to have — I hope it’s behind me — I would switch that vibration and transform it in a tune.”

The song that soothed him? Djokovic couldn’t quite recall at this post-match news conference.

“I’m trying to remember. Which one was it?” he said. “It was a famous song, actually.”

Djokovic completed a career milestone by winning the French Open this year, but the following months only brought frustration, injuries and discouraging losses.

He was mentally exhausted and decided he needed a new mind-set, prioritizing happiness on court, not winning.

Djokovic even hinted this week it could bring about a coaching change in the new year. Asked Thursday about the status of his coach, Boris Becker, he said they planned to finish off the rest of the season together. As for next season, he added, “We still haven’t talked about it.”

Becker did not accompany Djokovic to Shanghai.

Djokovic next plays 15th-seeded Roberto Bautista Agut in the semifinals. The Spaniard beat Jo-Wilfried Tsonga 6-3, 6-4.

Second-seeded Andy Murray played with the same focus and sharpness he has displayed all week, easily defeating 11th-seeded David Goffin 6-2, 6-2.

“I had to stay strong there in the second, because physically, although it was a 6-2, 6-2 match, it wasn’t easy because a lot of the points were tough,” Murray said.

Murray hasn’t been broken in three matches so far in Shanghai, and hasn’t dropped a set in his last nine matches going back to mid-September. He’s going for back-to-back titles in China after winning the China Open last week.

In the semis, Murray will play Gilles Simon, who beat Jack Sock 4-6, 6-4, 7-6 (5) in the day’s last quarterfinal.

Simon and Sock combined for 80 winners in the hard-fought, two hour, 40 minute match, including a tricky, between-the-legs lob by Sock in the first set that floated over the Frenchman and landed just inside the baseline.

Sock had been dominating the match early on, but took a tumble late in the second set after slipping on a wet spot and bloodied his hand. He lost the next two games to drop the set and let Simon back in the match.