The Russian star, seeded second in the tournament he won in 2003, dropped the first set but rallied for a 2-6, 6-2, 6-4 victory.
Davydenko's opponent in the next round will be the No. 7 seed, Frenchman Marc Gicquel.
Gicquel moved on with a 7-6 (7-5), 6-1 win over countryman Thierry Ascione.
Also advancing was Florent Serra of France, a 7-6 (7-5), 6-1 winner over Portuguese wild card Rui Machado.
Federer, who has won 12 Grand Slam titles, has yet to win a tournament this year.