The Brazilian shocked the number three seed by taking the opening set 6-3 with some sparkling tennis from the back of the court.
But Federer responded with typical composure to take the second with a reversed scoreline with the Californian crowd thriving on the unexpected contest.
Bellucci continued to threaten, but Federer took the final set 6-4 with a crucial break at 5-4, and the Swiss sealed his 13th successive Tour victory as a result.
The Brazilian was deservedly given a standing ovation for his efforts as he departed, while Federer was left to celebrate a tougher than expected encounter.
Federer admitted afterwards he has been battling flu at the elite ATP tournament.
A triple champion at the desert venue, Federer had initially been worried he would not be fit enough to compete in his opening match but he managed to get through that and has since felt increasingly better.
"I'm still hurting a bit, but at least I don't have a massive headache, aches and pains anymore," the third-seeded Swiss said.
"That's all gone now. I got maybe a bit lucky but it's taken some time to for me to get better, to be honest. I thought I would see quicker improvements."
Asked if he had considered withdrawing from the ATP Masters 1000 event, Federer replied: "The night was rough before my first-round match, and I was thinking, 'I don't know how I'm gonna do this.' But I woke up and I felt a little bit better.
"That went and I didn't feel good in the afternoon again. One hour before the match I started to feel better again. At that point I always knew I was going to go out on court and give it a try, at least.
"I knew I had a day off after that, after the first-round match. That really gave me the belief that I could do it, you know."
Federer, whose entire family has been battling flu symptoms, eased past American wild card Denis Kudla 6-4 6-1 in his opening match at the Indian Wells Tennis Garden.
He then survived an early storm from Canadian Milos Raonic before completing a 6-7 6-2 6-4 victory on Tuesday to advance into the fourth round.
Federer, who has won 36 of his 38 matches since last year's US Open, will face 2009 US Open champion
Ninth seed Del Potro came through a tough clash with
The Argentine won and lost a tie-break in the opening two sets of his gruelling clash with the Uzbek before eventually pulling away in the third and final set to complete a hard-fought 7-6(2) 6-7(6) 6-2 victory.