Serena Williams will retire from tennis after the US Open.

The 40-year-old star – who is widely regarded as one of the greatest players of all time – has confirmed on Instagram that she’ll walk away from the sport “in the next few weeks”.

Alongside an image of herself on the cover of Vogue magazine, Serena wrote on the photo-sharing platform: “Vogue. September cover issue. There comes a time in life when you have to decide to move in a different direction.That time is always hard when you love something so much. My goodness do I enjoy tennis. But now, the countdown has begun. I have to focus on being a mom, my spiritual goals and finally discovering a different, but just exciting Serena. I’m gonna relish these next few weeks [heart emojis] (sic)”

Serena – who has Alexis, four, with her husband Alexis Ohanian – also dropped a retirement hint after winning her first singles match in over a year in Toronto, Canada.

The former world number one beat Nuria Parrizas Diaz in straight sets, but admitted she’s nearing the end of her tennis career.

Discussing her motivation to keep playing, Serena said: “I guess there’s just a light at the end of the tunnel.

“I don’t know, I’m getting closer to the light. Lately that’s been it for me. I can’t wait to get to that light.”

Asked what the light represented, Serena responded: “Freedom. I love playing though, so it’s amazing.

“But I can’t do this forever. So sometimes you just want to try your best to enjoy the moments and do the best that you can.”

Serena was knocked out of Wimbledon last month in the first round, and the 23-time Grand Slam champion will walk away from the sport after the US Open, which will begin in New York on August 29.