The Serb looked to be in full control when he led 5-2 in the opening set but Spaniard Ferrer fought back to 5-5 and although he lost the opener the tone was set for an intense duel.
Djokovic eventually prevailed on his second match point having double-faulted on his first, the point in between being a 38-stroke baseline rally of extraordinary quality.
Celebrating his 23rd birthday Dimitrov was presented with a cake on the court which his coach Roger Rasheed splatted all over the Bulgarian's face.
Having taken the first set Djokovic was 3-2 ahead in the second set when a brief spell of rain halted play.
Two games later the relentless Ferrer broke and went on to serve out the second set in clinical fashion.
Djokovic forged ahead in the deciding set but Ferrer refused to be subdued by the more powerful Serb, scrambling back to 3-3.
Ferrer then had a sniff of a chance in the next game but Djokovic held firm and then broke to lead 5-3.
Djokovic wobbled on his first match point, serving a double-fault but he was not phased and went on to win a punishing baseline exchange in the next point and claimed victory when Ferrer hit a tired-looking backhand wide.
2-Novak Djokovic (Serbia) beat 5-David Ferrer (Spain) 7-5 4-6 6-3
12-Grigor Dimitrov (Bulgaria) beat 15-Tommy Haas (Germany) 6-2 (Haas retired)
8-Milos Raonic (Canada) beat Jeremy Chardy (France) 6-3 5-7 6-2
- Sports & Recreation
- Grigor Dimitrov
- Tommy Haas
- Milos Raonic
- Roger Federer