The world number one has competed in only two tournaments this season after a bout of glandular fever, but he barely broke sweat in beating Mahut. Federer hit nine aces and won 23 out of 24 points on his first serve and will now meet Croat Ivan Ljubicic. Federer suffered a surprise loss in the second round last year to Argentina's Guillermo Canas, having won at Indian Wells for three years in a row from 2004.
"I enjoy matches like this," said Federer after his win over Frenchman Mahut.
Having the sensation like I had towards the end of the second set when you feel everything's going your way, you've got his game perfectly figured out and everything you're trying to do sort of works as well, it's just a good feeling.
"I am overall excited being back, happy to be playing well. I feel like I did at the Australian Open after one of my first couple of matches but this time I'm more sure I'm over the sickness.
"I couldn't really practise the way I wanted to before the Australian Open. This time it's very different and I'm really looking forward to the rest of the week."
Earlier Argentina's David Nalbandian came from two points from defeat to overcome Radek Stepanek.
Seventh seed Nalbandian recovered from winning only 10 points in the second set to come through 7-6 0-6 7-6.
Nalbandian was serving at 3-5, 0-30 in the third when he began his comeback and won on his fourth match point.