But the veteran wilted visibly in the decisive third set, wearied by the demands of a heroic second set display that saw her level the match in a tie break.

As Tomljanovic raced into a 5-1 lead in the third, Williams summoned every last drop of her fighting spirit to stave off defeat, saving five match points in a marathon seventh game before finally succumbing.

Afterwards, Williams saluted the crowd, welling up as Tina Turner’s anthem “Simply the Best” belted out around the stands.

Asked by an on-court interviewer whether there was any possibility she might yet extend her career, she replied: “I don’t think so, but you never know.”

“It’s been a fun ride,” she added. “It’s been the most incredible ride and journey I’ve ever been on, I mean, in my life.

“I’m just so grateful to every single person that’s ever said, ‘Go, Serena,’ in their life. You got me here.”

Williams reserved special praise for her parents Richard Williams and Oracene Price who had set her and her elder sister Venus on the path to superstardom.

“It all started with my parents,” Williams said. “They deserve everything. So I’m really grateful for them.”

‘Greatest of all time’

Williams also paid tribute to her sister as she looked on from the stands.

“I wouldn’t be Serena if there wasn’t Venus, so thank you, Venus. She’s the only reason that Serena Williams ever existed,” she said.

Tomljanovic meanwhile expressed disappointment that Williams’ career had drawn to a close.

“I’m feeling really sorry just because I love Serena just as much as you guys do,” she told the crowd. “What she’s done for me, for the sport of tennis, is incredible.

“I never thought I’d have a chance to play her in her last match when I remember watching her in all those finals, so this is a surreal moment for me.”

Tomljanovic said she had also never felt certain of victory.

“Even to the last point, I knew that she’s in a position to win even when she’s down 5-1,” she said. “That’s just who she is. She’s the greatest of all time. Period.”

Tomljanovic, 29, has never gone further than the quarter-finals of a Grand Slam event and is ranked 49th in the world.

Yet the Australian showed magnificent composure in the face of tremendous pressure from Williams and a home crowd determined to will her opponent to victory.

Every unforced error or mistake by Tomljanovic was greeted by cheers from the New York crowd, who conversely remained mostly silent whenever the Australian fired off a winner.

Williams meanwhile was let down by her serve, widely regarded as one of the most reliably formidable weapons in her arsenal throughout her career. Though she was still able to send down 11 aces during the match, she was broken no fewer than eight times.

Tomljanovic had recovered from 5-3 down in the first set to break Williams, before rattling off four straight games to take the early lead.

Tomljanovic also forced a tie break in the second set after Williams had led 4-0. Williams took the breaker to level at 1-1, but the energy-sapping 1hr 23min second set clearly took its toll on the American.

The Australian looked by far the fresher of the two in the decider and she quickly built a 5-1 lead in the third before closing out the win.