Azarenka, from Belarus, had been sidelined since the Australian Open because of a left foot injury that required her to wear a boot for several weeks.
The two-time Australian Open champion, hampered by nerve damage between her toes, limped visibly at times, had trouble serving, fell to her knees several times, broke a racket after double-faulting to fall behind 4-3 in the second set, and fought back tears.
''Basically, all I had was my fighting spirit,'' Azarenka said. ''When I'm on the court I try to give as much as I can, even on one leg. I try to do my best in tough situations. That's part of our job.''
She isn't sure if she'll try to play in the Sony Open in Florida in 10 days.
''I want to be pain-free because it's not to the most fun to be out there like that,'' Azarenka said.
Most of the other second-round matches were routine. Second-seeded Agnieszka Radwanska of Poland got it started by beating qualifier Heather Watson of Britain 6-4, 6-3. Later in the day session, No. 6 Simona Halep, No. 7 Jelana Jankovic, No. 9 Sara Errani and No. 10 Caroline Wozniacki were straight-set winners. Two-time tournament champion Daniela Hantuchova of Slovakia, seeded 29th, fell to American Varvara Lepchenko, 6-3, 6-2.
Meanwhile, with the men finishing their first round, Roger Federer and Stanislas Wawrinka, the 2008 Olympic doubles gold medalists for Switzerland, teamed up again for a 6-2, 6-7 (4), (10-6) victory over Rohan Bopanna of India and Aisam-ul-Haq Qureshi of Pakistan in a match played in the new 8,000-seat Stadium 2.
''I don't know if it was sold out, but it felt like very, very full,'' said Federer, a four-time singles champion at Indian Wells. ''You're not probably going to achieve that on center court (where capacity is 16,100) for a doubles. But that was a perfect setup, a feeling, and we can thank the tournament and (owner) Larry Ellison for building such a court so quickly.
''It's nice to see the game grow and seeing people coming out and enjoying it. It's great. I really had a great time out there with Stan today.''
Wawrinka is the Australian Open champion.
''It took me time to realize really what I did in Australian Open,'' said Wawrinka, who is the No. 3 seed and could meet No. 7 Federer in the quarterfinals and top-seeded Rafael Nadal in the semifinals. ''Still when I'm saying that I won a Grand Slam it's still strange for me, but that's why it was good to be home during three weeks. It was good to be with the family, to take more time for myself.
Wawrinka's second-round opponent will be Ivo Karlovic of Croatia, and Federer will open his title bid against French qualifier Paul-Henry Mathieu. Wawrinka and Federer both will play Saturday afternoon.
On Saturday night, Nadal will take on Radek Stepanek.
Novak Djokovic, Andy Murray, Juan Martin del Potro, Richard Gasquet and Jo-Wilfried Tsonga are the other Top 10 players competing in doubles.