Nadal will next play 28th-seeded Damir Dzumhur, who beat John Millman in four sets.
It is the second year in a row that the seventh-seeded Ostapenko has advanced to the third round here after losing in the first round in her first appearance in Australia in 2016. "But it's a Grand Slam and every opponent is determined to win".
Their fellow Ukrainian, Kateryna Bondarenko, beat No. 15-seeded Anastasia Pavlyuchenkova 6-2, 6-3 in the day's opening match on Melbourne Park's third show court to reach the third round here for the third time.
Another of Tsonga's array of shots during the final set included one from between his legs for a victor.
Second-seeded Caroline Wozniacki had to save two match points and come back from 5-1 and 40-15 down in the third set to beat No. 119-ranked Jana Fett, and 2008 runner-up Jo-Wilfried Tsonga had to come back from 5-2 down in the fifth for his win.
The 15-year-old, who is ranked 521 in the world, was given a wild card into qualifying after winning the junior title last year, and this is her first main draw at any WTA-level tournament.
The opening game of the match featured what would be a theme of the match: break points, Kostyuk saving both to hold.
The Ukrainian is now on a seven-match win streak after winning the lead-up Brisbane International.
The victor of the junior title previous year, Kostyuk will take home 142,500 AUD if she loses to countrywoman Elina Svitolina next. However, her passage into the third round will now guarantee Kostyuk in excess of $100,000.
She picked up five WTA Tour titles a year ago, more than any other woman, making her a serious Grand Slam contender. She believes she's playing better and better with each match. Svitolina has been dealing with what she called "injury issues" and wasn't sure if she'd be fit enough to play in Melbourne.
Aged just 15, last year's Australian Open girls' singles champion is now the youngest player to reach the third round of a Grand Slam tournament since Mirjana Lucic-Baroni's run at the 1997 US Open after defeating Australia's Olivia Rogowska 6-3 7-5.
Kostyuk's performance in Melbourne is remarkable considering just how far she's come in such a short time.
Big gun Ashleigh Barty is the last local remaining in the Australian Open women's draw after Daria Gavrilova and wildcard Olivia Rogowska crashed out.
Another young talent, Belinda Bencic of Switzerland, was riding high after knocking out last year's Australian Open finalist, Venus Williams, in straight sets. After battling through a pair of deuces, she was gifted the deciding break on an untimely double fault by the Aussie. She served really well at times. She revealed that the experience of playing at the Rod Laver Arena in 2017 definitely helped her in the big game against Svitolina.