The Russian had lost all 12 of his previous clashes with the Swiss magician but produced an inspired performance in front of 17,500 enthralled fans inside the O2 Arena to resist a Federer fightback.
Federer was blown away in the first set, losing his serve three times, but he gradually found his range to level the match and then sought out victory in the deciding set.
With Davydenko serving to stay alive at 4-5, Federer conjured up a shot of breathtaking audacity, meeting a Davydenko smash with a leaping, swerving smash of his own to move within two points of yet another victory over Davydenko.
However, the Russian responded to reel off the next four points and then found the baseline with one of his pinpoint backhands in the next game to break Federer's serve.
As he served for the match, Davydenko slipped 30-40 behind but he came back with a sizzling forehand winner and claimed probably the most satisfying win of his career when Federer slapped a service return into the net after one hour 55 minutes.
"I waited for a very long time to beat Federer, losing 12 times, and to beat him in London it's very special," the 28-year-old Davydenko, who first lost to Federer in 2002, said on court after an admirably muted celebration on matchpoint.
"I knew Federer would try and come back and he tried to win at 5-4 on my serve but he didn't and I came back. When he hit that smash I thought he was lucky again, I thought: 'No, not again, 13 times in a row, to lose again'."
Davydenko will play Swede Robin Soderling or Argentina's Juan Martin del Potro in Sunday's final.