Azarenka is the last player to have beaten Williams. The occasion was the finals of the Qatar Open in February.
Halep broke Williams' serve to take an early 2-1 lead Saturday, but Williams then took charge with the first of her five service breaks.
Williams needed 68 minutes to notch the victory. She won 57 of the 89 points played in the match and served five aces.
Azarenka, representing Belarus, fell behind Errani 5-4 in the second set, much to the delight of her Roman fans. But Azarenka responded with a service break and won the next two games to retake the lead for good.