Andy Murray was given a stern test by Chinese wild card Zhang Zhizhen before making it through to the second round of the Shenzhen Open.
Playing his first match since losing in the second round of the US Open last month, Murray started well but was pushed to a deciding set by 340th-ranked wild card Zhang.
Murray had just secured the first break of the third set when Zhang abruptly retired, handing the Scot a 6-3 6-7 (3/6) 4-2 victory. He will face top seed David Goffin in the second round.
This was Zhang's first tour-level match of the season – although he did reach the quarter-finals in Shenzhen 12 months ago – and Murray was dominant in the early stages, winning five of the first six games.
But from there things became increasingly complicated as he failed to serve out the opening set at the first time of asking and then found himself under concerted pressure in the second.
Murray saved seven break points but Zhang converted his eighth chance to lead 4-2 and had an opportunity to serve out the set. He could not take it but was the better player in the tie-break.
As the match entered a third hour, Murray was in danger of suffering his worst defeat for 13 years, but, after finally breaking the Zhang serve in the sixth game, he was offered a handshake by the Chinese player.
The victory took Murray's record to six wins from 10 matches since his return from hip surgery, but he will no doubt need to raise his level if he is to beat 11th-ranked Goffin in the next round.
At his post-match press conference, the three-time grand slam champion said: "It's a really good test for me right now to play against guys who are in and around the top 10. I think he'll be the highest-ranked player I've played since I came back so it'll be good to see where my game is at."
Murray announced on Saturday that he will call time on his season after next week's tournament in Beijing in order to prepare for 2019.