The Swiss previously won 34 straight sets between the third round in 2005 and the final in 2006.
The Japanese remained in control and served it out to level the match and he appeared in the ascendancy as, after saving a break point, he then raced to a 0-40 lead on Djokovic's next service game.
Del Potro, who made more than 20 unforced errors in the set, made hard work of winning the tiebreak, clinching it 7-5 on the seventh set point when Simon put a return high and wide and the Argentine roared in celebration.
When Anderson broke again in the fourth, Federer was suddenly on the ropes.
The 32-year-old Anderson struck 65 winners and grabbed a decisive break in the 23rd game of the fifth set to seal victory after four hours and 14 minutes on Court One.More news: Stomping In Britain: Donald Trump And May's Brexit
Following the incident, Nishikor - the 24th seed who saved three break points to hold serve at 2-1 in the second set - promptly broke and then held to go 4-1 up.
"I think the first warning was unnecessary", said Djokovic, who was sanctioned in the second set for spearing his racquet into the court. "I didn't harm the grass", he said. Kei did the same in the fourth set but wasn't warned. He [Ramos] said he didn't see it. "From the second, it got better and I just tried to stay calm and fight every game". Federer's tweener against Djokovic in the 2009 US Open final remains an iconic shot. "I think it was great quality tennis and in the final set there were some awesome points", said Nadal who was a 7-5 6-7 4-6 6-4 6-4 victor.
"I've been building the last couple of weeks on the level of tennis that I've played the last couple of month, the last couple of clay-court tournaments and Queen's". "I feel like I'm peaking at the right moment".More news: Jack Wilshere signs for West Ham United
Anderson held for 5-all, broke to 6-5 with a violent return victor off a 97 miles per hour second serve, then staved off three break points and closed the set with a 133 miles per hour ace.
And when the world No. 28 could not then beat the net, Djokovic seized the initiative and pressed on for a four-set win. "I need to recover to give my best".
With Kevin Anderson taking nearly 3-1/2 hours to tame French showman Gael Monfils in the previous match, Djokovic knew he had about two hours of daylight left if he wanted to avoid coming back on Tuesday's rest day to finish off the contest.
"Double standards, my friend".
He will surely pose a threat for the 12-seed Djokovic.More news: Prince Louis, Prince William and Kate’s third child, is christened