After wasting two set points on Azarenka's serve late in the second set, Hampton had to leave the court for nine minutes to have treatment on her back.
Azarenka practiced her backhands and serve while Hampton was in the locker room, but the break didn't help her immediately. Hampton returned and held in the next game and needed more treatment in the break at the end of the set.
Even with the pain of two herniated disks, the 23-year-old Hampton, from Auburn, Ala., went down swinging — making 47 unforced errors to go with the winners that caught Azarenka off guard and had her asking, loudly at one point, what she could do to counter them.
Sensing an upset, and stirred by the obvious signs of pain, the crowd in Rod Laver Arena got right behind the No. 63-ranked Hampton, who had never previously gone past the second round at a major.
Azarenka had her share of supporters in the stands, too, including friend and musician RedFoo, who was wearing a shirt emblazoned with "We Go Hard" across the front.
If results go according to rankings, Azarenka and Williams will meet in the semifinals. Williams has won the Australian Open five times and is on a 19-match winning streak — and she has lost only one match since her first-round exit at the French Open last year.
Considering Azarenka has lost 11 of their 12 meetings, including all five in 2012, it's a potential matchup where Azarenka will have to play better than ever. But they both have to advance to the last four, something Williams failed to do here last year when she was knocked out in the fourth round.
In this year's fourth round, the 31-year-old American will meet No. 14 Maria Kirilenko, who beat No. 20 Yanina Wickmayer 7-6 (4), 6-3. Azarenka next plays Elena Vesnina, who beat 16th-seeded Roberta Vinci of Italy 7-6 (4), 6-4.
Two-time major winner Svetlana Kuznetsova continued her comeback from injury with a 6-2, 4-6, 6-3 win over Spain's Carla Suarez Navarro and advanced to a fourth-round match with former No. 1 Caroline Wozniacki, a 6-4, 6-3 winner over Ukrainian qualifier Lesia Tsurenko.