Rafael Nadal had his serve broken four times by one of his former ball boys before progressing to the second round of the China Open.
The world number eight beat China's 230th-ranked Wu Di 6-4 6-4 in his first match since being knocked out in the third round of the US Open last month.
Top seed Novak Djokovic improved his perfect record in Beijing to 25-0 by beating Italian Simone Bolelli 6-1 6-1.
His winning run started in 2009, when he won the first of five China titles.
Nadal dropped three straight games on his serve in the second set against the wildcard, who once tossed him balls and towels in Shanghai.
"The last three games of the match I was playing better. I hit some good forehands down the line and that's why I finished well,' said the 29-year-old Spaniard.
Nadal will play Canada's Vasek Pospisil in the second round. while Djokovic faces Australian qualifier John Millman.
In the women's event, US Open champion Flavia Pennetta of Italy rallied to advance to the third round with a 3-6 6-0 6-4 win over Brazilian Teliana Pereira.
Ana Ivanovic, seeded sixth, beat Venus Williams 7-6 (7-3) 6-2, while Caroline Wozniacki defeated Chinese wildcard entry Wang Qiang 7-5 6-0.