Maria Sharapova gains quarters
Need the scores from any match played in today's tournaments? Results
The second-seeded Russian was coming off a tough, three-hour win over British qualifier Heather Watson on Tuesday, while Safarova advanced to the third round on a walkover.
Sharapova coasted through the first set and led 3-0 before Safarova mounted a comeback, breaking Sharapova three times to take a 6-5 lead.
Sharapova broke Safarova in the final game to force a tiebreaker, which she won with an ace after 1 hour, 43 minutes.
"After a long match yesterday I was really happy to win in two sets," Sharapova said. "I had a bit of a letdown in the second set but was really happy that I could close it out in the tiebreaker."
Sharapova will face Sam Stosur in the quarterfinals. The eighth-seeded Australian beat Dominika Cibulkova of Slovakia 6-4, 7-5.
After struggling in the first set, the sixth-seeded Errani broke Bartoli in the second game of the second set and never looked back.
"It was a tough match on this fast court," said Errani, who has won three titles this year. "I didn't start off well but neither did she. She got a little tired in the second set and that's when I started to play better."
Copyright 2012 by The Associated Press
MORE TENNIS HEADLINES
- Murray engaged to marry longtime girlfriend
- French tennis federation official banned for life
- First for Federer as Swiss win Davis Cup
- Nadal criticizes captain for 'false' debate