Williams, the defending champion and five time Miami winner, was seeking to break the tie she holds with Steffi Graf of Germany. Both Graf and Williams have taken the Miami singles title on five occasions.
However today, Williams appeared to play through some left leg pain as she toiled on with her left thigh heavily taped.
Displaying little good footwork and clearly not near playing at 100%, Williams dropped the first set 6-3 before Azarenka held serve to move ahead 1-0 in the second set.
Azarenka scored an early second set break of serve as Williams' error count continued to soar. A Williams backhand hit long and her fifth doublefault of the match sent Azarenka ahead in set two 3-1.
Azarenka, sensing a major career opportunity, quickly held serve to reach 4-1.
In her final service game for the day, Williams fell behind 0-40. Azarenka sent a nervous backhand long before hitting an inside out forehand down the line for a winner to break serve to reach 5-1.
More nerves from Azarenka resulted in her doublefaulting twice in her final service game. However four deuces later, a final Williams error on the third matchpoint ended the American's Miami run.
To her credit Williams refused to call for the trainer at any point during the match or to afterwards use the leg injury as an excuse for her loss.
It was definitely tough, Williams said. I'm just glad to make it this far.
For Azarenka, the match marked a completion of some measure of revenge. The teen had led Williams in January at the Australian Open fourth round 6-3, 2-4 before she was forced to retire ill.
Azarenka Monday moves to a career high number eight in the WTA Tour rankings while Williams holds on to her top WTA Tour ranking for now.
I improved everything since last year, Azarenka said. I started believing in myself.
If however Williams is unable to win several claycourt matches in the next few weeks, it looks likely that the world number two Dinara Safina of Russia would eventually replace Williams at the top of the rankings for however brief a period of time.