Maria Sharapova got her revenge over Latvian 16th seed Anastasija Sevastova with a gutsy 7-6 (7/3), 5-7, 7-6 (9/7) victory in the China Open first round on Saturday.
It was the five-time Grand Slam winner's first appearance since she was beaten by Sevastova at the US Open in early September and gets her stop-start return from a doping ban back on track.
Sharapova, once number one but now ranked a lowly 104 in the world, is a wildcard in Beijing as she works her way back slowly from a 15-month ban for taking the banned substance meldonium.
She was far from her best, making a series of unforced errors, but Sharapova dug in and saved match point during an attritional encounter lasting more than three hours in the Chinese capital.
Sharapova, who has also been wrestling with injury, will take on American qualifier Jennifer Brady or fellow Russian Ekaterina Makarova in the next round.
"I didn't give in, which I think is a really good sign considering it's been a few weeks since I played and she was someone that I lost to in my previous match," said a relieved Sharapova.
The 30-year-old said that "physically and emotionally" she did not have it in her when she faced Sevastova in New York in the fourth round, but feels she is getting stronger in both respects.
"When I saw the draw (Sevastova again), I was like, 'Of course,'" added Sharapova with a grin.
Sharapova, who controversially returned to tennis in April, said she was feeling "fresh" and is eager to finish the season on a high.
"Winning is very special and when you lose it's tough and you have to go on and build and work on things that didn't work out for you," she said.
Asked how far she was from getting back to her peak, Sharapova declined to say: "It's not really the way I think."
Sevastova broke the Russian -- who had the majority of the crowd behind her -- in the seventh game of the first set to seize the early initiative.
Sharapova immediately broke back for 4-4, before falling 6-5 down on her own serve when her drop shot went astray, only to strike back immediately to force a tie break.
"Come on!" the former China Open champion shouted as she wrapped up the first-set tie break.
Sharapova looked set to race through the second set to book her place in round two.
But her serve was suspect all match and the Latvian refused to submit.
Sevastova broke Sharapova once more as the match clock hit the two-hour mark to level the encounter at one-set each, before Sharapova finally saw off her resilient opponent in an epic decider.
Earlier, the second seed Simona Halep battled past the American Alison Riske in three sets, 6-3, 3-6, 6-2.