The six-time champion overcame a two-set deficit to avert a monumental first-round upset, beating Alejandro Falla 5-7, 4-6, 6-4, 7-6 (1), 6-0.
Federer has reached the tournament final each of the past seven years, but Monday he barely survived the traditional opening match on Centre Court as defending champion.
CBSSports.com: Wimbledon Scoreboard
"I live another day," Federer said. "This one is one I should have lost. That's sometimes how grass-court tennis works."
The 60th-ranked Falla had lost all 11 sets in his previous four matches against Federer, but the Colombian played brilliant tennis to take charge of the match early. The turnaround came in the fourth set with Falla serving for the match and three points from victory, when Federer broke for only the second time.
Federer played his best after that. It's the third time in a row he has won after losing the first two sets at a Grand Slam event, but the close call was a new experience in such an early round.
"You definitely feel uncomfortable," Federer said. "For me it's not normal to be down two sets to love. Especially at Wimbledon and early on in Grand Slams, it's something I'm not quite used to."
After winning the first two sets, Falla received treatment from a trainer during the next three changeovers for an upper left leg injury, but he said it didn't affect the outcome.
No. 5 Andy Roddick, who lost to Federer in last year's epic final, began his title bid by beating fellow American Rajeev Ram 6-3, 6-2, 6-2. Roddick never faced a break point and committed only 10 unforced errors.
In women's play, five-time champion Venus Williams beat Rossana de los Rios 6-3, 6-2. Williams hit 31 winners to four for de los Rios.
"It's definitely good to be back," said Williams, seeded second behind her sister Serena, the defending champion. "I love playing on the grass."
Grand Slam champions Kim Clijsters and Justine Henin began Wimbledon comebacks with victories. Clijsters won easily in her first match at the All England Club since 2006, beating Maria Elena Camerin 6-0, 6-3. Henin, playing at Wimbledon for the first time since 2007, defeated Anastasija Sevastova 6-4, 6-3.
American Melanie Oudin, who made a surprising run to the fourth round last year as a 17-year-old, defeated Anna-Lena Groenefeld 6-3, 6-0.
French Open champion Francesca Schiavone lost to Vera Dushevina, 6-7 (0), 7-5, 6-1 in nearly three hours. The No. 5-seeded Schiavone committed 38 unforced errors and fell to 0-2 since the improbable run to her first Grand Slam title.
Like Federer, No. 7 Nikolay Davydenko overcame a two-set deficit, beating Kevin Anderson 3-6, 6-7 (4), 7-6 (3), 7-5, 9-7. Anderson hit 36 aces.
Dustin Brown, the first Jamaican man to play in a Grand Slam tournament since 1974, lost to No. 16 Jurgen Melzer 6-3, 4-6, 6-2, 6-3.
The first day's play began in warm sunshine and ended with the Centre Court roof closed at twilight to allow the completion of No. 3 Novak Djokovic's match against Olivier Rochus.
For Falla, the pivotal moment came when he served for the biggest victory of his career at 5-4 in the fourth set. He made shaky errors on the first two points, and a pair of deft forehands by Federer gave him the break.
Federer ran away with the tiebreaker, taking advantage of four more unforced errors by Falla, and the deflated Colombian mustered little resistance in the final set.
"I definitely got very lucky today out there," Federer said.
"I think about the lost opportunity," Falla said. "On the other hand, I played a great match. I had Federer against the ropes."
There had been signs coming into the tournament that Federer might be vulnerable. He lost at the French Open this month in the quarterfinals, his earliest Grand Slam exit in six years. Then he dropped to No. 2 in the rankings behind nemesis Rafael Nadal. Then at a Wimbledon warm-up event came Federer's second grass-court defeat since 2003, extending his drought of nearly five months without a title.
But no one expected so much trouble against a 26-year-old journeyman who has yet to win a tournament. There were stretches of stunned silence from the crowd, dumbfounded by the score. Fans also roared in appreciate of Falla's frequent winners.
"He played great," Federer said. "He was the one who put me in that kind of a score. I thought I was actually playing decent. Credit to him."
The match was Falla's third in the past four weeks against Federer, which at first worked to the Colombian's advantage.
"It shouldn't have," Federer said before cracking a smile. "He should have known that I was going to beat him. But he forgot I beat him."
Falla came to the net often and made good use of crosscourt shots from the baseline. The left-hander was unfazed by Federer's serve, one of the sport's best, and repeatedly won points serving to Federer's backhand - a tactic frequently employed by another lefty, Nadal.
Federer searched for more than two hours to find his championship form. He slipped several times on the immaculate lawn and shanked shots, hitting one forehand so wild that Falla had to leap out of the way.
Federer was 0-for-6 on breakpoint chances before putting a forehand winner on the line to close out the third set. He lost serve to start the next set, and found himself on the verge of defeat with Falla serving at 5-4.
Then Federer's big surge began. Barely 30 minutes later, he kissed the line with his final shot for a winner and walked to the net to give Falla a sympathetic pat on the shoulder.
Wimbledon 2010 (Official Website)