And while Federer's form since then has been poor, with defeats by lowly Frenchman Gilles Simon and big-hitting Ivo Karlovic in his next two Tour tournaments and James Blake in the Olympics, Nadal has continued to go from strength to strength, allowing him to overhaul his rival.
The Spaniard won the Toronto Masters at the end of July and then guaranteed he would top the rankings by reaching the semi-finals in Cincinnati at the start of August before Novak Djokovic inflicted his only defeat in his last 39 matches.
Nadal has 6,700 ranking points, with Federer second on 5,930 and Djokovic third on 5,105. Britain's Andy Murray is sixth on 2,415 points.
Nadal becomes the 24th player since the ATP rankings were introduced in 1973 to hold the number one position, and the third Spaniard after Carlos Moya (1999) and Juan Carlos Ferrero (2003).
"I'm very happy but the feeling doesn't change much because the last years I did well too," said Nadal.
"For sure there's satisfaction, but at the same time I don't have time to celebrate. I play New York (in the US Open) in one week."
Cannot play media. Sorry, this media is not available in your territory.
Nadal thrilled with Olympic gold
Federer feels Nadal deserved to take the number one spot after performing at such a high level in recent months.
"That's what I expected and hoped for many years ago when I got to number one, that if ever somebody were to take it away from me, he would have to play an incredible tennis schedule, win the biggest tournaments, dominate the game basically, and then like this he can take number one," Federer said.
"I didn't want it to happen that I would play completely bad and somebody would pick up number one in the world. So I think Rafa totally deserves it."
Following his victory in Beijing, Nadal will also be heavy favourite for the US Open which begins on 25 August, although he has never previously been beyond the quarter-finals there.
Flushing Meadows is another stronghold for Federer, who has won there for the last four years, and another below-par performance will be seen as evidence of his continuing decline.
Federer has won 12 Grand Slam singles titles in all, with the last coming in New York a year ago.
The first signs of his growing vulnerability came in the Australian Open in January, when he failed to defend his title after falling to Djokovic in the last four.
Federer's singles form since Wimbledon has been dismal
At the time, Federer's loss was put down at least partly to weakness following a bout of glandular fever, but his loss of form has continued throughout the year.
Nadal has always been the stronger on clay so it was perhaps no surprise that he beat Federer on that surface in Masters finals at Monte Carlo and Hamburg in the spring.
But much more damaging was the 6-1 6-3 6-0 thrashing he handed Federer in the final at Roland Garros to clinch his fourth-straight French Open title.
Federer had not lost a set 6-0 since 1999 and the defeat showed the gulf between the two on clay was greater than ever.
At that stage, however, Federer was still the undisputed king on grass but even that did not last for much longer.
Although Federer retained his title in Halle, Nadal dethroned him at Wimbledon in an epic five-set encounter in the final to claim his first Grand Slam away from Paris.
Nadal wins Wimbledon
Since then, Federer has lost to three opponents - Simon, Karlovic and Blake - who had never troubled him in the past.
He did team up with Stanislas Wawrinka to win Olympic gold in the men's doubles but his singles form means there are serious doubts over his ability to defend his US Open title.
The length of Federer's spell at the top of the rankings shows his dominance of the men's game - in the 35 years since the ranking system began, the 160 weeks that Jimmy Connors spent at number one between July 1974 and August 1977 was the previous highest consecutive total.
Only Pete Sampras, with 286 weeks in 10 separate spells, has spent more time in total as world number one.
But Federer will need a huge reversal in his recent fortunes if he is to threaten that mark, or beat the record of 14 Grand Slam titles that Sampras also holds.
Meanwhile, Ana Ivanovic has regained her position as the top women's player by replacing fellow Serbian Jelena Jankovic, who held the number one spot for just one week.
French Open champion Ivanovic, who pulled out of the Olympics with a thumb injury, will hold the position for at least three weeks, according to the WTA, the governing body of women's tennis.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.