Wimbledon - Djokovic wins late night Wimbledon clash
The top seed and defending champion from Serbia was not at his best but was still far too strong for the world number 48, breaking him in the ninth game of the third set to move to the brink of victory.
His only moment of concern came when trailing 0-40 at 2-3 in the second set but he survived the break points before regaining control of the match.
Djokovic failed to convert his first match point when he netted a drive volley but he sealed victory with a service winner to set up a third-round match against 28th seed Radek Stepanek or German Benjamin Becker.
"I was in trouble in the second set and we went the full distance until 10pm at night under the roof and it was difficult to adjust," Djokovic said after the match.
Federer produced a performance on Centre Court that was fittingly majestic given the presence of Prince Charles in the royal box.
Federer bowed to the heir to the throne before his match and Charles and his wife Camilla gave the Swiss maestro a standing ovation after he thrashed Fognini.
"We are thrilled for the tennis family that they came to watch today," Federer said after his imperious display.
Two years ago, Queen Elizabeth paid her first visit to Wimbledon since 1977, prompting women's champion Serena Williams to put in some serious practice on her curtseying technique.
As six-times champion, Federer was well aware of what the royal etiquette is on the world's most famous tennis court.
"They do brief you beforehand so that you don't do anything stupid," Federer said. "We were asked to bow which obviously is no problem."
But Federer did take time in the tunnel leading to Centre Court to explain the procedure to Fognini. They both bowed in perfect union to Prince Charles, who had in turn received his own standing ovation from fans when he appeared in the royal box above the court.
The match itself was a royal procession for Federer who never once looked in any danger.
His glorious groundstrokes and lightning fast movement across the court were greeted with unbridled admiration from the crowd. The graceful genius was at the peak of his form - except at the very start.
He drew gasps of incredulity when he lost the first two points of the match on his serve but normal service was promptly restored when he fired down two aces.
The Italian became so disheartened at the end of the first set that he did not even bother to try and chase down yet another stinging forehand from Federer. He just walked back to his chair, shoulders slumped.
Federer lost just four points on his serve in the second set and was swift to complete his clinical execution of Fognini in the third.
It was a routine day at the office but the third seed has shown he is still very much a contender after dropping just nine games in his first two matches at the tournament he so dearly loves.
"I really tried to focus hard and make sure I played a clean match, "Federer said. "I served 13 aces out there today. I felt it was pretty fast."
Several first-round matches had to be completed on Wednesday after rain and bad light ended play early the previous evening.
Spain's seventh seed David Ferrer finished off Germany's Dustin Brown 7-5 6-4 6-4 but 25th seed Stanislas Wawrinka, who partnered Federer to Olympic doubles gold in Beijing four years ago, lost a five-set cliffhanger to Juergen Melzer.
The big-serving American was a set and a break up when the match was suspended in the early evening gloom and drizzle on Tuesday, but he came back to finish off his opponent after a break of almost 22 hours.
Three-times runner-up Roddick had struggled to crank into gear, labouring to the first set in a tiebreak before breaking in the fourth game of the second.
Baker lacked the weapons to threaten 30th seed Roddick who broke in the 11th game of the third set before closing it out with an ace to set up a second-round match against German Bjorn Phau.