Williams improved to 11-1 overall against Azarenka, winning the last nine matches. Williams beat Azarenka in the semifinals of Wimbledon and at the London Olympics.
"Maybe I'm doing the right things at the right time," said Williams, who also beat Azarenka to win the U.S. Open title before taking six weeks off.
Despite the loss, Azarenka can secure the No. 1 position with another victory in the round-robin tournament, which features the top eight players.
Williams, who is projected to finish the year at No. 3, won her third match at the event when Azarenka served a double-fault. Azarenka also lost the first set on a double-fault and finished with nine.
"I had a lot of opportunities and I didn't use them. I couldn't keep up," Azarenka said. "It's one of these days, I am a little said because I broke her a lot and I had a lot of chances."
The Belarusian squandered a 3-0 lead in the second set as Williams won the next four games.
"I just was able to play better than I did in my first couple of rounds," Williams said. "That was what I was going to have to do going up against the No. 1 player in the world."
Li Na beat Angelique Kerber of Germany 6-4, 6-3 in another Red Group to retain a slim chance of advancing. Sara Errani defeated Samantha Stosur 6-3, 2-6, 6-0 in the White Group.
Stosur replaced defending champion Petra Kvitova, who withdrew because of illness.
Li's first win in two round-robin matches means the Chinese player can still reach the semifinals, depending on other results in her group.
The fifth-ranked Kerber, making her first appearance in the season finale, bowed out after losing all three of her matches. She played more than three hours on Wednesday night in a three-set loss to Azarenka.
The top two players from each group advance to the semifinals.
Williams and Maria Sharapova, who was idle Thursday, have already qualified for the semifinals.
Sharapova, the French Open champion, could still take the No. 1 ranking away from Azarenka.
Williams has dominated the second part of the season, winning Wimbledon, the U.S. Open and Olympic gold in London. She's won 46 of her last 48 matches, but because of injuries and missed tournaments, cannot attain the top ranking.