World number one Ashleigh Barty also reached the third round on Wednesday.
Japanese third seed Osaka put a “childish” outburst behind her to beat Saisai Zheng 6-2 6-4 before 15-year-old Gauff saw off Romania’s Sorana Cirstea.
The world number 67 was 3-0 down in the deciding set but fought back to win 4-6 6-3 7-5 in two hours and six minutes.
“It’s amazing,” said Gauff. “Honestly, I didn’t think I would get so much support in Australia. I was down 3-0 and you really made me believe.”
Osaka, 22, went through in straight sets but threw her racquet on the floor and kicked it after China’s Zheng broke her serve in the second.
“My racquet just magically flew out of my hand,” joked Osaka, who won in one hour and 20 minutes.
“I couldn’t control it, I think that’s how I dealt with my frustration.
“It was a bit childish. I just want to play one match without throwing my racquet or kicking it. That’s all I want.”
Gauff v Osaka – part two
It is the second Grand Slam in a row where Gauff will play Osaka, who was also the defending champion when the pair met in the US Open third round in September.
The Japanese triumphed 6-3 6-0 that day but it was the way she consoled the American youngster that stole the headlines.
Osaka gave Gauff a big hug at the net before inviting her tearful opponent to stay on the court with her to speak to the crowd. The Japanese even apologised for playing so well against her.
Gauff is looking forward to the re-match.
“She’s a great competitor so I think it’s going to be a good match,” said the American, who is playing in just her third Grand Slam and making her debut at the Australian Open .
Barty, Wozniacki & Kvitova through
Australian Barty, who reached the quarter-finals at Melbourne Park last year, eased to a 6-1 6-4 victory against Slovenia’s Polona Hercog in just over an hour.
Caroline Wozniacki recovered from going 5-1 down in the opening set to win 7-5 7-5 and put off her impending retirement for at least another match.
The 2018 champion won six games in a row to clinch the opening set and also went 3-0 down in the second before mounting a comeback against Ukrainian 23rd seed Dayana Yastremska.
The Dane, 29, will face Tunisia’s Ons Jabeur, who beat British number one Johanna Konta in her opening match, in the third round.
Meanwhile, Czech seventh seed Petra Kvitova, who was beaten by Osaka in last year’s final, progressed with a 7-5 7-5 victory over Spain’s Paula Badosa.
American 14th seed Sofia Kenin saw off compatriot and wildcard Ann Li 6-1 6-3, while Germany’s Julia Goerges knocked out Croatia’s 13th seed Petra Martic in a 4-6 6-3 7-5 victory.
In her final season before retirement, Spain’s Carla Suarez Navarro won her first-round match against Belarusian 11th seed Aryna Sabalenka 7-6 (8-6) 7-6 (8-6) to set up a meeting with Polish 18-year-old Iga Swiatek.