The Russian trailed 4-1 and 5-3 in the opener before hitting back to take the set and then held off a spirited challenge from the 20-year-old McHale before squeezing through.
After the slippery clay of last week's Madrid Masters, the players had to cope with gusting winds which disturbed their fluency.
"It was really about adjusting from Madrid," Sharapova told a news conference after setting up a third-round clash with either Ana Ivanovic of Serbia or Spanish qualifier Silvia Soler Espinosa.
"I made a few too many unforced errors at first and maybe I was going for too many lines but she was extremely consistent.
"I was a bit lucky to get out of the first set and the second set was close but she's definitely improved since the last time I played her. I'll have to improve in the next round too."
Wimbledon champion Petra Kvitova survived a tough match with Anastasia Pavlyuchenkova of Russia, recovering from a slow start to advance 7-5 6-4.
Former world number one Venus Williams, in her fourth tournament back since she was diagnosed with the energy-sapping Sjogren's Disease, reached round two with a 6-3 6-4 win over Simona Halep of Romania.
In the other first-round matches, three of the minor seeds fell to lower-ranked opposition: Sabine Lisicki of Germany, Jelena Jankovic of Serbia and Maria Kirilenko of Russia were beaten by Romania’s Sorana Cirstea, New Zealand’s Marina Erakovic and Italy’s Flavia Pennetta respectively.
The 14th seed Dominika Cibulkova managed to get through though, the Slovakian beating Mirjana Lucic of Croatia 6-1 6-2.