Federer, who lost his Australian Open crown in January and had to wait until last Sunday to claim his first title of the year in Estoril, said: "He's a tough player on clay. Maybe my attacking game did not work so well.
"I'm still close (to beating him). It's not getting much easier but I am right there and it's a good thing."
Federer, who was on the brink of defeat against Spanish qualifier Ruben Ramirez Hidalgo in the first round, said he felt relieved to be back.
"I am coming back strong and am happy the way things are now," said the Swiss, who had mononucleosis earlier this year.
"A few weeks ago I was still in a bit of doubt."