Novak Djokovic coach Marian Vejda explain in an interview how the Serb beat Federer and Rafael Nadal always.
He said mostly he played many matches against them and he knew when was the right time to play aggressive. Against Federer he pushed him to play longer rallies and that paid off. He felt Federer was getting tired little by little although at that point i expected him to be better at the end of the fourth set which Federer was too tired and Novack was leading 4-2 in the end.
Also the same thing happen against Nadal but he was clever enough to seal the game with a comeback and long set.