Azarenka found herself in serious trouble losing the second set against 23-year-old American Hampton who appeared to take all the momentum.
However, she suffered a back-related hamstring complaint late in that second set and that only continued to get worse during the deciding third set allowing the defending Australian Open champion to come away with a hard fought 6-4, 4-6, 6-2 victory.
It was far from a convincing performance from the Belarusian, though, against an opponent who if she can stay healthy, certainly has shown an ability to be ranked much higher than her current spot of No. 63 and can push the top women in the sport.
However, the world No. 1 did enough in the end to prevail and afterwards was glad to get through a tough match where she didn’t feel she played at all well.
"I don't think it was the best performance honestly today, but in the other hand I know I can play better so there's a positive note from there. This kind of match sometimes can bring better things for you in the future," Azarenka said.
"When you aren’t playing well or feeling great it's important to be alive in the tournament still. I'm glad about that, but definitely she played an outstanding match. I think she surprised everybody today.
"I didn’t really see her play before but my coach did and said that she didn’t play like that in other matches that he saw, but she definitely went for everything there was today and she had nothing to lose. She played loose and free, so I felt like it was her day today but I'm glad I won in the end."
Azarenka will next face the winner of the Russian Elena Vesnina who won a tight three-set battle with Italian to advance to the fourth round. In over two and-a-half hours of court time, Vesnina prevailed 4-6, 7-6 (4), 6-4 to book a clash with the world No. 1.
Meanwhile, straight up on Rod Laver Arena after Azarenka's match was Williams and the tournament favourite and world No. 3 had little trouble disposing of Japan's world No. 72 Ayumi Morita in straight sets, 6-1, 6-3.
Williams cruised through the first set in just 31 minutes, but then Morita did catch the 15-time Grand Slam winner off guard early in the second set going out to a 2-0 lead. However, the 31-year-old American fought back to then win the last four games to win 6-3.
Williams' performance was highlighted by a 207km/hr first serve and she was delighted with that, and her overall display against Morita.
"I feel good. I was really just focused today and my opponent did play really well, and gave me a good test and a lot of balls, so it was good," Williams said.
"I tried to hit that serve really hard and I hit 207 the other day, but I thought it was luck. But I did it again, so I was like woooo. I'm going to try to go for 210 now, we'll see and I'm going to try."
Williams will next face Russia's Maria Kirilenko who also won on Saturday in the third round against Belgian Yanina Wickmayer, 7-6 (4), 6-3. The 14th seed Russian has now beaten Nadia Petrova and Peng Shuai on her way to the fourth round.
"This match actually reminded me of my second match when I played here and the quality of the game was so good with so many really good rallies," Kirilenko said.
"I was just a little bit luckier than her today."
In the other completed women's singles match so far on Saturday, Russian Svetlana Kuznetsova advanced to the fourth round with a hard fought three-set win over fellow veteran Carla Suarez-Navarro, 6-2, 4-6, 6-3.
The 2004 US Open and 2009 French Open winner will take on the winner of the third round clash between Caroline Wozniacki and Lesia Tsurenko in the fourth round.