Agnieszka Radwanska also advanced, recording six service breaks during a 6-4, 6-1 victory over Venus Williams.
Azarenka had won her first 26 matches of the year, capturing four tournaments in the process. She will retain her No. 1 world ranking despite her 6-3, 6-3 loss to Bartoli, who dropped a 7-5, 6-4 decision to Azarenka in their only other meeting this year.
The winning streak had been the best to open a season since Martina Hingis went 37-0 to begin the 1997 campaign. Azarenka came into this tournament as the defending champion.
Bartoli defeated a No. 1-player for the third time in her career. She won over Justine Henin in the semifinal round at Wimbledon in 2007 and was a winner over Jelena Jankovic in the 2009 Australian Open.
Radwanska eliminated Williams the day after Serena Williams fell to Caroline Wozniacki in their quarterfinal encounter. It was the second time in seven tries Radwanska had beaten Venus Williams, who was playing in her first tournament since withdrawing from last year's U.S. Open.
Radwanska will meet Bartoli in Thursday's semifinals with Wozniacki facing Maria Sharapova in the other match.
Sharapova has lost two championship battles this year to Azarenka -- at the Australian Open and at Indian Wells, Calif.