Sharapova will meet fourth seed Nadia Petrova, who advanced with a 6-7 6-4 6-1 victory over Virginie Razzano of France.
Second seed Jelena Jankovic outlasted Victoria Azarenka 6-4 6-7 6-2 to earn herself a semi-final match-up with fellow Serbian and third seed Ana Ivanovic, who beat Maria Kirilenko of Russia 6-4 6-4.
After looking like she was on her way to a simple victory when leading 4-1 in the second set and holding a break point, Sharapova was pushed to close out the match.
Dementieva rifled a forehand down the line on break point and eventually held to 4-2. She then immediately broke Sharapova at love to 4-3 on a backhand crosscourt winner.
But after Dementieva held to 4-4, Sharapova regained her stride, holding easily to 5-4 and in the final game, winning a marathon rally where Dementieva missed a drop shot winner, and then nearly smashed the umpire's chair with her racket in frustration.
MENTALLY STRONG
"I was huffing and puffing, but I think I did a good job of playing defence and offence," said Sharapova, who won last week's San Diego Classic.
"I needed to mentally stay strong and not get too frustrated," Sharapova said. "I wasn't in my top energy, but I was seeing the ball clearly."
Jankovic, who has been battling a bad cold all week, was not on top form and spent much of the match complaining to the chair umpire, whom she thought had lost control of the contest.
"I thought she was a little confused," Jankovic said.
However, the Serbian managed to play steady enough in the third set to subdue the 18-year-old Belarusian, who was powerful yet inconsistent.
"I wasn't on my game, didn't have my rhythm and she was hitting so many let cord winners in the second set and I was thinking, god, how am I going to pass through because nothing is going my way. I just wanted to win and get out of there."
Ivanovic survived an up and down contest against Kirilenko, going down 1-4 in the first set, before taking the next seven games and then struggling to close it out.