Williams, who had not competed in singles on tour since withdrawing from Wimbledon last year with an injury, lost in three sets to Harmony Tan of France.WIMBLEDON, England — It was the 21st time that Serena Williams has played Wimbledon. It was Harmony Tan’s first time, but Tan will be the player heading to the second round at the All England Club.Tan, a Frenchwoman ranked 115th who is little-known even in her country, defeated Williams, the greatest women’s tennis champion of her era, 7-5, 1-6, 7-6 (10-7). Williams had not played a singles match on tour since retiring in the first round of last year’s Wimbledon in tears with a hamstring injury, but she got to play plenty of tennis on Tuesday evening on the Centre Court where she had won seven Wimbledon singles titles. Her grueling duel with Tan was a stylistic contrast that lasted 3 hours and 11 minutes. What was missing for Williams was the upbeat, reaffirming finish, and she did not hesitate when asked if she was OK with this being her final Wimbledon memory if that was the way it turned out.“Obviously not. You know me. Definitely not,” Williams, 40, said. “But today I gave all I could do, you know, today. Maybe tomorrow I could have gave more. Maybe a week ago I could have gave more. But today was what I could do. At some point you have to be able to be OK with that. And that’s all I can do. I can’t change time or anything.” She did succeed in changing the momentum on Tuesday in a match that was played under open skies for the first set and then under cover the rest of the way after the roof was closed to provide the stadium lighting necessary to continue. Williams dominated the second set but Tan fought back in the third while Williams’s level and energy dipped even if her fighting spirit did not. Though she saved a match point on her serve late in the final set and jumped out to a 4-0 lead in the super tiebreaker, which is new at Wimbledon this year, she could not hold on, missing too many crucial shots, including a forehand into the net on Tan’s second match point.“I think physically I did pretty good,” Williams said. “I think the last couple points, I was really suffering there, but I feel like in just those key points, winning some of those points, is always something mentally that you have to have, that you kind of need. I did pretty good on maybe one or two of them, but obviously not enough.”Tan’s clear-thinking poise under big-match pressure was remarkable for a player with so little experience and who was making her first appearance on Centre Court. But she said she had to struggle within herself to believe that she really could defeat Williams.“When I saw the draw I was really scared, because it’s Serena,” said Tan, 24. “She’s a legend, and yeah, I was like, ‘Oh my God, how can I play?’ If I can win one or two games, it was really good for me.”She won two sets instead, turning what could have been a feel-good story for Williams into a narrow defeat that will repose the question of how much more professional tennis Williams intends to play. She will turn 41 in September, and her quest for a record-tying 24th Grand Slam singles title seems increasingly far-fetched. A longtime No. 1, she is now ranked 1,204th and will soon have no ranking at all. But she provided no definitive answer to whether this was her final Wimbledon appearance. “That’s a question I can’t answer,” she said. “I don’t know. Who knows where I’ll pop up?”But at least she can leave the All England Club with a less painful memory than what she took from last year’s Wimbledon, when she tore a hamstring after slipping in the first set of her first-round match with Aliaksandra Sasnovich, hobbling off Centre Court in great distress. She did not play competitively again until last week when she returned to play doubles in Eastbourne, England, with Ons Jabeur. Tuesday’s match against Tan was Williams’s first singles match in a year, and to her credit, she scrapped and hustled through the peaks and valleys.“It was definitely long, a very long battle and fight and definitely better than last year,” Williams said.It was a ragged but ultimately admirable performance as she tried to shake off the rust and solve the myriad riddles posed by Tan, who had watched Williams only from afar until their duel. “Seeing her next to me before we walked out on court was really intimidating, because she’s so imposing,” Tan said in French. “It was difficult and even at the end, when we shook hands, she was still imposing.”“When I was young I was watching her so many times on the TV,” she said in her on-court interview. “My first Wimbledon is wow!”Harmony Tan, a Frenchwoman ranked 115th, lacks pure power but understands tennis geometry.Alberto Pezzali/Associated PressThat Williams came close to victory was more a tribute to her willpower than her power as she failed to dominate with her first serve or full-cut returns and instead battled her way through extended rallies and compromised situations in the third set, digging low for Tan’s crisply sliced shots and hustling into the corners. Williams served for the match at 5-4 and was two points from victory at 30-15 only to lose the next three points and her serve when she hit an unconvincing forehand approach shot that Tan slapped past her for a backhand winner. Williams and her player box full of family, friends and team members, including her new coach Eric Hechtman, were not able to celebrate. She fought off a match point when serving at 5-6, 30-40 with a forehand volley winner. She then had to navigate the tiebreaker despite the weariness in her legs and the tension in her gaze. She jumped out to a 4-0 lead before Tan reeled off the next five points by keeping Williams off balance. Tan, coached by the 1998 Wimbledon finalist Nathalie Tauziat, lacks pure power and has a puffball second serve, but she understands tennis geometry and has an unconventional tool set that is well suited to grass. She also had a good scouting report: Tauziat is 54 and long retired but she faced Williams three times in singles, defeating her in the final of an indoor tournament in Paris in 2000 on a fast, low-bouncing surface. Tauziat understood the importance of keeping Williams out of her prime hitting zones and of keeping her on the move.“Thank you, Nathalie,” Tan said in her on-court interview, looking toward Tauziat in the player box.From the start, Tan had Williams guessing and stretching, mixing often-exquisite drop shots with forays to the net; towering lobs with counterpunched backhand passing shots; sideswiping forehand slices with looped topspin.“Any other opponent probably would have suited my game better,” said Williams, who was rarely able to settle into power-baseline duels or any particular pattern of play for long.No one but Tan knew what was coming. Williams, who has lost to such variety-loving players even in her prime, often looked befuddled in the early going. She also looked as tight as piano wire, struggling to let her natural power flow and missing swing volleys and approach shots by the bunch while laboring to move laterally.That was certainly understandable in light of her long layoff, and the crowd reacted with awkward silence at first. The grand tennis theater where Williams has experienced so many highs and a few lows through the decades was nearly half empty at the start but as the match turned into a marathon, it was filled with support and emotion as Williams tried to avoid only the third first-round exit of her career in a Grand Slam tournament.She could not quite manage it, despite all her evident desire, and there may not be many more major tournaments to come, although Williams did not rule out a return to the U.S. Open, where she won her first Grand Slam singles title in 1999 at age 17.“Your first time is always special,” she said, speaking slowly and softly. “There’s definitely, you know, lots of motivation to get better and to play at home.” More