They were playing on Court No. 1 - Federer's first match away from Centre Court since the same stage of the tournament in 2015.
Djokovic wrested back the momentum for good after coming from 0-40 down at 2-2 in the third set to hold serve, and then breaking Nishikori in the next game.
Federer eventually cracked at 11-11, double-faulting to hand Anderson a break point which he converted when the defending champion hit a weary-looking forehand halfway up the net.
Next up for the American will be Milos Raonic, who overcame Isner's countryman Mackenzie McDonald 6-3, 6-4, 6-7 (5/7), 6-2.
He has also held serve for 81 successive games at the tournament, a run stretching back the first set of his semi-final win against Tomas Berdych in 2017.
"I don't think it's something anybody aims for, to win every match in straight sets".
Victor of World's Ugliest Dog competition, Zsa Zsa, dies
Zsa Zsa , known for her pink toenails and lolling side-swept tongue, died in her sleep on Tuesday morning. Zsa Zsa was about nine years old when she passed away, which is about the life expectancy for the breed.
Roger Federer and his flawless run through the 2018 Wimbledon tennis tournament thus far next face Kevin Anderson in Wednesday's Men's Singles quarterfinals match.
"We'll see. Hopefully", said Djokovic when asked if he expected to face Japan's Kei Nishikori on the most famous arena in tennis. He won the match, 2-6, 6-7, 7-5, 6-4, 13-11.
After a slump following two years of nearly total domination of the men's game, Djokovic's star appears to be back on the rise and he is a clear contender to win a fourth Wimbledon title.
There was still the small matter of holding serve but a 28th ace helped settle Anderson's nerves and be brought up match point with a massive forehand before completing a remarkable victory with a first serve that Federer could not handle.
"The fans on Court One will love seeing [Federer], maybe Centre Court ticket holders will be upset, but they have two brilliant matches to look forward to". He's absolutely rolling, and he's conserving energy, as his longest match was an hour and 45 minutes against Mannarino.
Nadal reached the quarterfinals of Wimbledon for the first time since 2011 after defeating Jiri Vesely in a 6-3, 6-3, 7-5 victory on Monday.
Now the 32-year-old South African moves on to a semifinal against No. 9 John Isner of the USA or No. 13 Milos Raonic of Canada.
Later, Ramos warned Djokovic for a time violation, but that didn't seem to faze the Serb.