In her first appearance in the tournament since 2009, Williams took advantage of six double-faults by Azarenka at Ariake Colosseum.
Azarenka said after Tuesday's match that she wasn't well and hadn't been able to practice for three days because of her condition.
"She didn't seem like herself at all," Williams said. "Hitting the double-faults, I could tell she wasn't feeling her best. I am not sure what was bothering her but I hope she feels better."
Azarenka, who lost to Serena Williams in the final of the US Open, broke Williams to make it 4-4 in the second set after trailing 4-2. But Williams came right back in the next game to go up 5-4, then served out to win the match in 1 hour, 21 minutes.
"I didn't sleep at all last night," Azarenka said. "You can't play at 20 percent against one of the top players. I've been feeling bad for a couple of days and it just got worse today."
In 2011, Williams withdrew before her second-round match at the US Open because of Sjogren's syndrome, an autoimmune disease, and came into the Tokyo tournament 63rd in the world rankings.
"I've had some issues, to say the least," Williams said. "But I like to think that builds character, and I've got a whole lot of character. I'm getting better every tournament, my serve is better, my back is better, a lot of things are getting better."
Svetlana Kuznetsova also advanced by beating third-seeded Sara Errani 6-4, 6-4. The two-time major winner will next face 15th-seeded Sorana Cirstea, who beat Japanese wild-card entry Misaki Doi 6-1, 6-2.