Melbourne - Caroline Wozniacki had tears in her eyes as she kept alive her dreams of a triumphant farewell to tennis at the Australian Open on Wednesday.
The 29-year-old former world No 1 roared back in both sets to defeat 23rd-seeded Dayana Yastremska of Ukraine 7-5, 7-5.
Neil Diamond's hit "Sweet Caroline" rang around a blustery Margaret Court Arena after the Dane nailed her sixth match point to reach round three.
She plays Ons Jabeur of Tunisia on Friday.
"It's a little bit emotional for me," said Wozniacki, the 2018 Australian Open winner who announced in December that this would be her final tournament.
"The crowd really got behind me so that was so special. Thank you everyone for coming out today, it really means a lot to me," she added, fighting back tears.
The 19-year-old Yastremska, beaten by world number one Ashleigh Barty in last week's final in Adelaide, threatened to put a swift end to Wozniacki's career.
But having been 5-1 down in the first set, Wozniacki - who suffers with rheumatoid arthritis, which causes fatigue and joint pain - fought back to claim the set in 53 tough minutes.
Now ranked 36th, having ended 2010 and 2011 at No 1 in the world, Wozniacki was similarly quickly down 3-0 in the second set.
But once again she battled back to make it 4-4, then held her own serve to lead 5-4 and within touching distance of round three.
Yastremska then required a medical timeout for what appeared to be a left thigh problem, and returned to court with heavy strapping.
She saved five match points, but with the crowd firmly behind her, Wozniacki would not be denied at the sixth attempt, the young Ukrainian looping a forehand long.
Tribute to Dad
The Dane, who says that a major reason for retiring was to start a family with her husband and former NBA star David Lee, admitted that she feared at the beginning that Yastremska would blow her away.
"She came out swinging... and everything was going in, even balls that I don't think she knew were possible to hit it that way," said Wozniacki, who has won 30 WTA titles in a professional tennis career going back to 2005.
"I was just thinking to myself: it surely can't continue. If it's going to continue, then there is not much I can do."
Wozniacki, who began playing tennis aged seven, is coached by her father Piotr, a former professional footballer.
Asked what the best decision had been in her career, she said: "I think sticking with my dad and that partnership, I think, has made me the player that I am today.
"I definitely wouldn't have been where I am today if it wasn't for him because the trust that was there between us and just the journey was amazing."
Results on day three of the Australian Open Grand Slam at Melbourne Park on Wednesday:
Tennys Sandgren (USA) bt Matteo Berrettini (ITA x8) 7-6 (9/7), 6-4, 4-6, 2-6, 7-5
Sam Querrey (USA) bt Ricardas Berankis (LTU) 7-6 (7/2), 4-6, 6-4, 6-4
Guido Pella (ARG x22) bt Gregoire Barrere (FRA) 6-1, 6-4, 3-6, 6-3
Marton Fucsovics (HUN) bt Jannik Sinner (ITA) 6-4, 6-4, 6-3
Tommy Paul (USA) bt Grigor Dimitrov (BUL x18) 6-4, 7-6 (8/6), 3-6, 6-7 (3/7), 7-6 (10/3)
John Millman (AUS) bt Hubert Hurkacz (POL x31) 6-4, 7-5, 6-3
Stefanos Tsitsipas (GRE x6) bt Philipp Kohlschreiber (GER) walkover
Milos Raonic (CAN x32) bt Cristian Garin (CHI) 6-3, 6-4, 6-2
Marin Cilic (CRO) bt Benoit Paire (FRA x21) 6-2, 6-7 (6/8), 3-6, 6-1, 7-6 (10/3)
Diego Schwartzman (ARG x14) bt Alejandro Davidovich (ESP) 6-1, 6-4, 6-2
Dusan Lajovic (SRB x24) bt Marc Polmans (AUS) 6-2, 6-4, 6-3
Yoshihito Nishioka (JPN) bt Daniel Evans (GBR x30) 6-4, 6-3, 6-4
Novak Djokovic (SRB x2) bt Tatsuma Ito (JPN) 6-1, 6-4, 6-2
Roger Federer (SUI x3) bt Filip Krajinovic (CRO) 6-1, 6-4, 6-1
Fabio Fognini (ITA x12) bt Jordan Thompson (AUS) 7-6 (7/4), 6-1, 3-6, 4-6, 7-6 (10/4)
Roberto Bautista Agut (ESP x9) bt Michael Mmoh (USA) 5-7, 6-2, 6-4, 6-1
Sara Sorribes (ESP) bt Veronika Kudermetova (RUS) 2-6, 6-1, 6-1
Anett Kontaveit (EST x28) bt Astra Sharma (AUS) 6-0, 6-2
Iga Swiatek (POL) bt Timea Babos (HUN) 6-3, 6-2
Carla Suarez (ESP) bt Aryna Sabalenka (BLR x11) 7-6 (8/6), 7-6 (8/6)
Elise Mertens (BEL x16) bt Danka Kovinic (MNE) 6-2, 6-0
Heather Watson (GBR) bt Kristyna Pliskova (CZE) 4-6, 6-3, 6-1
Anastasia Pavlyuchenkova (RUS x30) bt Nina Stojanovic (SRB) 6-1, 7-5
Taylor Townsend (USA) bt Jessica Pegula (USA) 6-4, 7-6 (7/5)
Ashleigh Barty (AUS x1) bt Polona Hercog (SLO) 6-1, 6-4
Elena Rybakina (KAZ x29) bt Greet Minnen (BEL) 6-3, 6-4
Alison Riske (USA x18) bt Lin Zhu (CHN) 6-3, 6-1
Julia Goerges (GER) bt Petra Martic (CRO x13) 4-6, 6-3, 7-5
Maria Sakkari (GRE x22) bt Nao Hibino (JPN) 7-6 (7/4), 6-4
Ekaterina Alexandrova (RUS x25) bt Barbora Krejcikova (CZE) 6-1, 6-3
Petra Kvitova (CZE x7) bt Paula Badosa (ESP) 7-5, 7-5
Naomi Osaka (JPN x3) bt Saisai Zheng (CHN) 6-2, 6-4
Cori Gauff (USA) bt Sorana Cirstea (ROU) 4-6, 6-3, 7-5
Shuai Zhang (CHN) bt Caty McNally (USA) 6-2, 6-4
Sofia Kenin (USA x14) bt Ann Li (USA) 6-1, 6-3
Ons Jabeur (TUN) bt Caroline Garcia (FRA) 1-6, 6-2, 6-3
Caroline Wozniacki (DEN) bt Dayana Yastremska (UKR x23) 7-5, 7-5
Qiang Wang (CHN x27) bt Fiona Ferro (FRA) 6-1, 6-2
Serena Williams (USA x8) bt Tamara Zidansek (SLO) 6-2, 6-3
Madison Keys (USA x10) bt Arantxa Rus (NED) 7-6 (7/3), 6-2