Wozniacki, who is retiring from the sport after the tournament's conclusion, recovered from a double break down to go 7-5 up against the Ukrainian, who she lost to in their only prior meeting in Cincinnati last year.
Highlights of Wozniacki's gritty victory against Yastremska
- Watch all courts and all matches of the Australian Open live on Eurosport and Eurosport Player
- Australian Open 2020 order of play
- Australian Open LIVE!
And the Dane was broken early in the second and, leaving her trying to claw back a 3-0 deficit and the No 23 seed Ukrainian took the opening set.
But Wozniacki showed her battling qualities when she got a break to level before eventually taking it 7-5.
The Dane then registered the same scoreline in the decisive third after an injury-hampered Yastremska saved three match points at 5-5.
Wozniacki will face Ons Jabeur in the next round after the Tunisian beat Caroline Garcia of France 1-6 6-2 6-3.
Emotions running high
It’s a little emotional for me’ – Wozniacki's interview after battling past Yastremska
"She came out really flying and she hit so hard and so precise and I didn't know what to do," Wozniacki said post-match.
"But she started making a few errors and I got more depth on my ball.
The crowd got behind me, that was so special, thanks for coming out today, it means a lot to me.