The Australian Open champion, who took over the No. 1 ranking by winning in Melbourne, struggled for long stretches but came back to beat Alberta Brianti of Italy 6-7 (6), 6-4, 6-2.
"Sometimes I felt it was not my day. Sometimes I thought, 'yeah, maybe I still fight. I still have a chance,'" Azarenka said. "Sometimes it was like, 'you know what? Forget it. I don't want to do it.'"
Brianti, a 32-year-old veteran who has won one WTA title in her career, won the first set and then led 4-0 in the second before losing six straight games. She nearly served for the match but Azarenka saved two break points before making it 4-1 in the second set.
And although Azarenka rebounded over the final two sets, she finished the match with 60 unforced errors.
"I think it says it all. Bad days happen," Azarenka said. "Unfortunately today I had way more mistakes than I usually do, but, you know, it happens sometimes."
Both Novak Djokovic and Roger Federer managed more straight-forward victories.
The top-ranked Djokovic, who is trying to win his fourth straight Grand Slam title, never faced a break point in beating Potito Starace of Italy 7-6 (3), 6-3, 6-1.
"It's just the first match here," Djokovic said in French on court after the match. "It's still a very long way to go before we talk about the final."
Earlier, Federer beat Tobias Kamke of Germany 6-2, 7-5, 6-3.
The 16-time major champion equaled Jimmy Connors' record of 233 career Grand Slam match wins in the Open era. Federer is 233-35 at tennis' top four tournaments. Connors was 233-49.
"That's a big one, because that was longevity," Federer said. "Jimmy is obviously one of the greats of all time, and was around for 20 years."
Defending women's champion Li Na also won easily, beating Sorana Cirstea of Romania 6-2, 6-1.
Last year, Li became the first Chinese player to win a Grand Slam singles title when she won at Roland Garros.
No. 3 Agnieszka Radwanska of Poland, No. 8 Marion Bartoli of France, No. 15 Dominika Cibulkova of Slovakia and No. 19 Jelena Jankovic of Serbia also advanced to the second round. But men's No. 15 Feliciano Lopez retired from his match with a side muscle injury after losing the first five games of the first set to Florent Serra.
Former top-ranked player Lleyton Hewitt also lost, falling to Blaz Kavcic of Slovenia 7-6 (2), 6-3, 6-7 (4), 6-3, while No. 7 Tomas Berdych of the Czech Republic, No. 10 John Isner of the United States and No. 11 Gilles Simon of France made it through.
The strangest finish of the day occurred when Alex Bogomolov Jr. retired from his match when he was one point from losing.
The Russian was trailing Arnaud Clement of France 6-2, 3-6, 4-6, 7-6 (2), 5-4 when he quit the match on match point while serving.
"My whole leg was straight. I couldn't bend it. I couldn't walk," said Bogomolov, who said his leg was cramping. "I didn't want to risk a potential ligament damage or something."
Azarenka was first up in the main stadium, and she didn't look good at the start. In the first set alone, she had 28 unforced errors.
"She started well ... but afterward she got a little bit tight. Things became a little bit more complicated for her," said former French great Amelie Mauresmo, who has been working with Azarenka. "She managed to turn the match around at the last minute by digging deep and finding the resolve to win."
The top-ranked Belarussian started the 2012 season with a 26-match winning streak. Her first loss came in the quarterfinals of the Sony Ericsson Open.
No top-seeded woman has ever lost in the first round at the French Open since the tournament began to allow foreign entrants in 1925.
In the other Grand Slam tournaments, it has happened four times, most recently when top-ranked and top-seeded Martina Hingis lost in the first round at Wimbledon in 2001.