Azarenka won 39 out of 72 points to claim the opening set, before the first three games of the second set went against serve, handing Hampton an early lead.
Hampton remained ahead, but she failed to convert two set points against the Azarenka serve before taking an injury timeout for treatment on a lower back injury.
After receiving a massage, she returned to court and immediately held to 15 to level the match at one set all.
Despite clearly being in pain, Hampton edged ahead in the deciding set when she broke Azarenka to 15 in game three.
However, the Belarusian then reeled off five straight games to seal the win after 129 minutes on Rod Laver Arena.