Federer has been atop the rankings since he used his win at Wimbledon to pass Djokovic, but he had closed 2011 with three tournament victories and has a huge pile of rankings points to protect.
He will lose some as a result of a runner-up finish at last week's Swiss Indoors, and even more by skipping this week's Paris Masters, both events he won last year.
That means Djokovic will return to the No. 1 spot next Monday and Federer won't be able to catch him again this year.
Djokovic had a record-setting year in 2011, when he also ended up with the No. 1 year-end ranking, and 2012 was strong by any measure. He's 70-11 this year with five titles -- the Australian Open, Shanghai Masters, Beijing, Canada Masters and Miami Masters. He was second in five other events, including the U.S. Open, French Open and three Masters tournaments.
He is the first player to end consecutive years as No. 1 since Federer did so in four straight years from 2004-07.
Federer is 68-10 this year, with six championships, including his record seventh Wimbledon title. He has been No. 1 for the last 17 weeks and a record 302 weeks overall.
Couple mistakenly served bag of cash at McDonald's drive-thru
Gal Gadot cast as Wonder Woman for 'Batman vs. Superman'