It was the second consecutive dominating victory in Miami for Bartoli who brushed aside 22nd seed Maria Kirilenko in the fourth round 6-1, 6-2.
Bartoli ended defending champion Azarenka's season-long win streak at 26 matches by posting her third win over a world number one and first in three years.
"I really went on court with a lot of belief in myself, and I stayed very focused at the end," said Bartoli. "I'm so happy."
Bartoli previously beat No. 1s Justin Henin of Belgium in 2007 at Wimbledon and Jelena Jankovic two years later at the Australian Open.
Bartoli finished with two aces, five double faults and won 68 percent of her first-serve points against Azarenka in the 97-minute match.
Azarenka had five double faults and won just 49 percent of her first serve points as she tried but failed to play catchup for the second straight match.
In her fourth round match, Azarenka dropped the first set and then fell behind 5-2 in the second set against Dominika Cibulkova before fighting back to win in three sets.
But there would be magical comeback this time as Bartoli used her counterpunching style to blunt Azarenka's athletic baseline game.
"I have to be proud of what I have done in the last couple of months," Azarenka said. "I am a human not a superwoman. I wish I could be, but I am not."
Bartoli will next face Agnieszka Radwanska who brought Venus Williams' comeback to a halt on Wednesday, downing the American 6-4, 6-1.
The 23-year-old Radwanska from Poland reached the semi-finals here for the first time, after getting to the quarter-finals each of the past two years.
She needed one hour, 21 minutes to overcome Williams, who was playing her first WTA tournament in more than six months after her abrupt withdrawal from the second round of the US Open, where she revealed she had been diagnosed with the auto-immune disorder Sjogren syndrome.
Williams said it was frustrating not to be able to execute all elements of her game as well as she'd like.
"I think out of all the matches, today was probably the one where I had the least pressure in terms of someone who was going to maybe hit winners on me or pressure me.
"So it was disappointing not to be able to feel my best today," she said. "I was able to keep it close in the first set and try different strategies, but it was definitely a mental battle, and today I didn't conquer the mental part of it."
Even so, Williams was pleased to have made it so far in her first tournament back.
"It's been a great tournament," said the American, who is scheduled to play in Charleston next week. "I'm obviously disappointed, would have liked to have gone further, but, it's a great start."
Williams, 31, is hoping to raise her world ranking high enough to allow her to compete at the London Olympics.
Currently 134th in the world, she is projected to move up to around 90th when the new rankings are released on Monday thanks to reaching the quarter-finals here.
What the stars mean:
★ Poor ★ ★ Promising ★★★ Good ★★★★ Very good ★★★★★ Exceptional