"This was not the result that I wanted, but I can take a lot out of this match," said Sharapova. "I've not competed for a few weeks, but I played pretty solid and did all of the right things. I served well in the first set but had a few doubles at the wrong time. Physically, I felt quite strong."
The five-time Grand Slam champion, who turned 31 last week, looked to be in control as she made just two unforced errors in winning the opening set.
But Garcia, who had never beaten the Russian in four previous meetings — they last played in Madrid three years ago — rallied in the second set as she came from 4-2 down and and levelled the contest in a tie-break.
The 41st-ranked Sharapova returned to tennis in Stuttgart exactly a year ago after finishing a 15-month doping ban for meldonium and reached the semi-finals.
She claimed an early break in the third set, but lost it in the third game as Garcia tightened the screw on the crowd favourite.
Sharapova was broken to trail 4-5 and put her opponent under momentary pressure at 0-30 as Garcia tried to serve out the win.
But the world number seven succeeded on her second match point as Sharapova struck a return wide to exit after two and three-quarter hours of battle on the indoor clay court.
Sharapova said her game might have been compromised by weeks of forearm injury recovery after last playing in Indian Wells six weeks ago.
"Overall I didn't react as well as I could against a server like her, she got lot of free points," Sharapova said. "I didn't get enough balls back. We were both playing fast, and aggressive. I need to be smarter in the winning position."
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ