The Swiss fourth seed was barely troubled in a 6-1, 6-1, 6-3 win over Italian Paolo Lorenzi, a player who has never won a match at a Grand Slam in 13 attempts, while Nadal was forced to work harder to beat dangerous Slovak Martin Klizan 4-6, 6-3, 6-3, 6-3, reports Xinhua.
The Spaniard will face Lukas Rosol, who upset him in 2012, in the second round.
Federer, who finished his match with an ace and will next face either Gilles Muller of Luxembourg or Frenchman Julian Benneteau, was happy with his opening effort.
"Getting the first one out of the way is always a good feeling, " said the 32-year-old.
"I thought I played well, got a lot of breaks and served well."
The win for Nadal, who was beaten in the first round last year by Belgium's Steve Darcis, was his 700th top-level career victory.
"It means I have had a very long and successful career and I am so happy for that, but the most important thing today was the win, " he said.
"I really know it is impossible to play my best in the first round. For sure the next round will be tough. The last three years I did not play much on grass and that affects your rhythm and confidence.
"Lukas Rosol is a very dangerous player, very strong and powerful. I will have to play very well if I am to win."
Federer's compatriot Stan Wawrinka has a poor record on grass, losing in the first round in three of the last four years at Wimbledon.
But the Australian Open champion, seeded fifth, served solidly to come through 6-3, 6-4, 6-3 against world number 41 Joao Sousa of Portugal.
Elsewhere, eighth seed Milos Raonic from Canada, 10th seed Kei Nishikori of Japan and 14th seed Jo-Wilfried Tsonga also advanced to the second round.