Sharapova's encounter with Foretz had looked to be heading for a swift conclusion after a totally one-sided opening set.
Foretz, the best part of a foot shorter than her 6ft 2in opponent, showed occasional fine touches at the net, but could do little about the stream of winners that flowed from Sharapova's racquet.
But having finally adjusted to the pace and intensity of the encounter, Foretz showed far more of her ability in the second set.
Some unforced errors crept into Sharapova's game, culminating in her losing serve for the first time to allow Foretz to close to 4-3 behind.
Any hopes of an upset were soon ended though, as Sharapova - sporting shorts and a tuxedo-style shirt - finally put an end to Foretz's brave challenge.
"It was great to get out there and get a feel for the court," Sharapova told BBC Sport.
Sharapova sports new 'tuxedo look'
"It was my first match on grass this year so I did pretty well. I still have some things to work on though, and it will get tougher and tougher with every round."
As for her latest contribution to the Wimbledon fashion parade, she said: "I've been very inspired by menswear this year.
"Every time at Wimbledon I want to do something classy and elegant and I thought 'why don't we do shorts?'"
Meanwhile, veteran Ai Sugiyama set a new record for consecutive appearances in Grand Slam tournaments.
The 32-year-old beat Yanina Wickmayer 6-4 6-2 in her 57th consecutive appearance in a Grand Slam, beating the previous record of South Africa's Wayne Ferreira.
Sugiyama started her Grand Slam career at Wimbledon back in 1993, making the quarter-finals in 2004.
Another 32-year-old, 1999 champion and 25th seed Lindsay Davenport, battled through injury to record a 6-3 5-7 6-3 win over Renata Voracova.
"It's been bothering me now for a few weeks," she said. "In the latter stages of the second set, I definitely felt like it was getting worse. I didn't feel great in the third.
"Luckily, I was able to hit some good shots and go for winners. I actually felt like I started hitting the ball a little bit better because I felt like I needed to do more with it.
"I'm just hoping it pulls up well. Some days it feels OK, and other days it is a problem."
Women's wild celebrations after marathon wins
Ninth seed Dinara Safina held off a spirited first-set challenge from Yung-Jan Chan to seal a 7-6 (10-8) 6-2 win, while Daniela Hantuchova, Vera Zvonareva and Nadia Petrova all had good workouts before sealing victories.
Fellow seeds Victoria Azarenka, Francesca Schiavone, Flavia Pennetta, Sybille Bammer and Caroline Wozniacki also progressed to the second round.
India's Sania Mirza, the 32nd seed, recorded a scrappy 7-6 3-6 6-4 win over Colombia's Catalina Castano as she continued her comeback from a wrist injury.
But 23rd seed Katarina Srebotnik fell to an epic 4-6 7-6 (8-6) 16-14 defeat at the hands of Germany's Julia Goerges.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.