Diyas, a crafty counterpuncher ranked No. 53, was able to extend rallies and deal with Williams’s superior flat power by bending low, her knees scraping the green space behind the baseline.
She also kept Williams on the move, repeatedly hitting drop shots and going down the line with her forehand. The drop shots were ineffective, even if Williams is still working her way back into top physical shape.
But the match was tight — a great deal tighter than the last time Williams played Diyas in Indian Wells, defeating her in the third round in 2015, 6-2, 6-0.
Much has changed since that mismatch, when Williams was in the midst of a 186-week run at No. 1. She is unranked now, having not played for more than a year.
She last played an official singles match on Jan. 28, 2017, when she defeated her older sister Venus Williams to win the Australian Open and her 23rd major singles title.
She was two months pregnant when she won that Grand Slam title. She gave birth to a daughter, Alexis Olympia, last September and married Alexis Ohanian in November.
She returned to tour-level tennis last month when she was part of the United States Fed Cup team, which defeated the Netherlands in a first-round match in Asheville, N.C. But Williams only played doubles there, losing an essentially meaningless match with her sister with the United States team’s victory already guaranteed.
Thursday’s encounter, which came three days after she played in a short-format exhibition in Madison Square Garden, felt much more like the start of her comeback.
“Welcome home!” a fan shouted from the stands shortly after the match began.
“Thank you guys for coming out,” Williams said after her victory. “It was incredible. You know, it’s been over a year and a kid later, and I get to go home now to her, so I’m excited about that.”
Williams will be back on the court again on Saturday, facing a bigger and more powerful test in the form of Kiki Bertens, the No. 29 seed.