Federer swept past the 772nd-ranked left-hander 6-0, 6-3, 6-4 in a match played under the Centre Court roof on a rainy day at the All England Club.
The seven-time Wimbledon champion won the first seven games and was always in control. Willis was the lowest-ranked qualifier to reach the second round at a Grand Slam since 1988.
"It was very refreshing to play against an opponent like this," Federer said. "I always knew it was going to be a completely different match than everything that I've played before here at Wimbledon."
He compared it to the time he walked out to play Pete Sampras on Centre Court in 2001.
"I remember how nervous I was and how big a deal it was," Federer said. "You had nothing to lose and you could just go out there and enjoy yourself. Marcus did that wonderfully."
While Willis savored the moment, smiling, laughing and playing to the raucous crowd throughout the match, there was never much doubt about the outcome.
"I was enjoying it out there," he said. "If I'm playing well and competing with Roger Federer for a couple of sets, I'm doing the right things. I've still got a lot to learn, a lot of improving to do.
"It sounds funny," he added, "but I'm disappointed to lose. I went out there trying to win."
Djokovic, the defending Wimbledon champion, won his 30th straight match at a major tournament Wednesday, sweeping into the third round with a clinical 6-4, 6-3, 7-6 (5) victory over Adrian Mannarino under the roof on Centre Court.
The win gave Djokovic sole ownership of third place on the all-time list for most consecutive victories in Grand Slam play. Only Rod Laver with 31 and Don Budge with 37 have won more in a row.
Djokovic hasn't lost a Grand Slam match since falling to Stan Wawrinka in the 2015 French Open final. He hasn't dropped a set so far this week as he bids for a fourth Wimbledon title, fifth straight Grand Slam championship and 13th major overall.
For two sets and most of the third, Djokovic had little trouble against the 55th-ranked Mannarino, a French left-hander playing on his 28th birthday.
But the match came to life with Djokovic serving for the match at 5-4. He served two double-faults, his seventh and eighth of the match, and was broken for the first time.
Then, in the tiebreaker, Djokovic moved out to a 5-2 lead after a pair of cross-court winners. Two points later, Mannarino played a soft drop shot. Djokovic raced forward and slipped and fell onto his back, his racket flying, as he knocked the ball into the net.
Djokovic was unhurt -- and unfazed -- and he closed out the match three points later.
Djokovic's match, like Federer's, was played in its entirety under the retractable roof, which was closed after steady rain lashed the grounds and forced delays on all other courts.
Before play was stopped by rain on the outside courts, No. 10 Tomas Berdych completed a 7-5, 7-5 (5), 5-7, 6-1, 7-6 (2) win over Ivan Dodig.
Other seeded players to have their matches called off Wednesday includedKei Nishikori (5), Marin Cilic (9), David Goffin (11) and Ivo Karlovic (23).
In an effort to get matches done, tournament officials to change the men's first-round doubles matches to a best-of-3 set format, while the remainder of the event will continue as a best-of-five.
The last time men's doubles was reduced to best-of-three for the first round was 2011. This is the eighth time that Wimbledon has made this change to the men's doubles since the start of 1980. In 2004, the competition was forced to best-of-three through the quarterfinals.
The Associated Press contributed to this report.
Willis slips, falls and lobs winner over Fed's head
Marcus Willis hits a lob that Roger Federer returns to the other side of the court; Willis chases it, slips, falls and recovers in time to lob it again over Federer's head to win the point.