Williams, a four-time winner at the All England Club, saved four match points before the ninth-seeded Frenchwoman closed out the contest by hitting a service winner into the corner. It was Williams' earliest exit at Wimbledon since a third-round loss in 2005.
Bartoli made the Wimbledon final in 2007, losing to Serena's older sister Venus.
Serena missed nearly a year after foot surgery and subsequent blood clots in her lungs. She returned two weeks ago at Eastbourne for the first time since winning the Wimbledon title in 2010.
Williams had 20 unforced errors Monday to go with 29 winners, and managed to convert only one of five break points. Bartoli served 10 aces, two more than Williams, and kept down her errors to 17.
It was the first time Bartoli has beaten the American after straight-set defeats in their previous two matches.
"Beating Serena is almost like a dream come true," Bartoli said. "Even though she didn't play for almost one year, she's probably one of the greatest champions in women's tennis.
"For me to be able come back after having three match points and losing this game at 6-5, and still be able to bounce back, it's really huge." In men's play, fourth-seeded Andy Murray moved into the quarterfinals by beating Richard Gasquet of France 7-6 (3), 6-3, 6-2 - then took a deep bow to the Royal Box, where Prince Wiliam and his new bride Kate joined the rest of the crowd in giving the British winner a standing ovation.
Murray, who has made the semifinals the last two years, is trying to become the first British man to win the title at the All England Club since Fred Perry in 1936.
Bernard Tomic, an 18-year-old Australian qualifier, downed Xavier Malisse 6-1, 7-5, 6-4 to become the youngest man to make the Wimbledon quarterfinals since Boris Becker in 1986.
Among the women's winners was 2004 champion Maria Sharapova, who made it to the quarters here for the first time in five years, beating Peng Shuai 6-4, 6-2 on a sweltering day.
Sharapova started slowly before winning seven straight games to take command against the 20th-seeded Chinese player in an early match on Court 2. The big-hitting Russian had 27 winners and 10 unforced errors.
The match was played with on-court temperatures measured at 34 degrees Celsius (93 F), and Sharapova covered her legs with ice wrapped in towels during changeovers.
Sharapova could next face top-seeded Caroline Wozniacki, who was playing Dominika Cibulkova in the next match on Court 2.
"Last year I lost in the fourth round to Serena and this year I find myself in the quarterfinals and I'm giving myself an opportunity to go even in further so I'm quite happy about that,"
Sharapova said. "I have to be a little realistic about the fact that I haven't gotten past the fourth round in a few years. This is a step forward." The first woman to move into the quarters was fourth-seeded Victoria Azarenka, who beat Nadia Petrova 6-2, 6-2. German wild card Sabine Lisicki reached the quarters for the second time, downing Petra Cetkovska 7-6 (3), 6-1.
No. 8 Petra Kvitova, a semifinalist here last year, needed just 45 minutes to defeat No. 19 Yanina Wickmayer 6-0, 6-2.
Tamira Paszek, an 80th-ranked Austrian, beat another 20-year-old player - Ksenia Pervak of Russia - 6-2, 2-6, 6-3 to secure her first Grand Slam quarterfinal berth.
Sharapova said Monday's scorching heat, after a first week marked by frequent showers and cool temperatures, made it "like playing a completely different tournament." "You see everyone putting sun screen on and I had the ice bag out today," she said.
"I'm used to it. I grew up in Florida and still live there and train there. I'm used to the humidity, so that really helped me." On Centre Court, William and Kate - who were married on April 29 - received a warm ovation from the crowd as they took their seats in the front row of the Royal Box in time for Murray's match. In keeping with Wimbledon's all-white dress theme, Kate wore an off-white, knee-length dress.
William wore a blue suit.
St. James's Palace said the couple were at the All England Club "privately." The palace said Kate is an avid tennis fan and has been to Wimbledon "quite a number of times." Queen Elizabeth II came to Wimbledon last year for her first visit in 33 years.
Monday's schedule featured the busiest day in Grand Slam tennis - all 16 men's and women's fourth-round matches.
Two stood out in particular: Top-seeded Rafael Nadal against 2009 U.S. Open champion Juan Martin del Potro, and five-time women's champion Venus Williams against No. 32 Tsvetana Pironkova in a reprise of a 2010 quarterfinal won by the Bulgarian.
The top four men - Nadal, No. 2 Novak Djokovic, No. 3 Roger Federer and No. 4 Murray - lost a total of three sets during Week 1.