Seventh-seed Bartoli moves into the semi-finals where she will face Poland's
Azarenka's winning streak was the best start to a WTA Tour season since Martina Hingis won 37 in a row in 1997.
The Belarusian's impressive run included wins in her last four tournaments, Sydney, the Australian Open, Doha and Indian Wells, but it was clear the run had taken a toll.
Bartoli played with aggression and confidence from the outset to take the game to Azarenka, who appeared short of inspiration and heavy on her feet.
"Physically I was just not able to do anything today. It was just not possible. You know, I'm a human, not a super woman. I wish I could be but I'm not," she said.
"But Marion really played really well today, and she deserves the win. What else can I say?"
The Frenchwoman produced a superb cross-court return to break and go 4-3 up in the second set, the decisive blow which finished off Azarenka's resistance.
"I just went out on the court full of belief in myself," said a delighted Bartoli, who raised her arms aloft in delight at beating the top seed.
"I'm working extremely hard, and I'm just happy that everything is paying off right now and I'm able to play some great tennis," she added.
Williams, playing in her first singles tournament since her shock withdrawal from last September's U.S. Open with Sjogren's Syndrome, said her late-night match against Ana Ivanovic on Monday had affected her.
"I was up until like 4am recovering from the match and all the things that you have to do after," said Williams. "So the next day I think I should have rested more."
The auto-immune disease causes fatigue and joint soreness and, after doing well to reach the last eight by outlasting Ivanovic in three sets, Williams looked sluggish in the latter stages of Wednesday's 80-minute match.
World number four Radwanska, who won in Dubai in February, enjoyed a 74 percent first serve while Williams, who entered the tournament as a wildcard, paid the price for 33 unforced errors.
The American, however, was encouraged to have made it to the last eight in her first tournament back.
"This is definitely a start," said Williams, whose sister Serena was eliminated by Caroline Wozniacki on Tuesday, "I've definitely learned a lot about ways that I could prepare during the tournament."