Swiss 17-time Grand Slam champion Federer, who swept the New York hardcourt crowns from 2004-2008, dispatched Argentina's 48th-ranked Carlos Berlocq 6-3 6-2 6-1 in 95 minutes, firing six aces and 37 winners.
"I was pretty comfortable out there," Federer said. "So that was a good sign."
Federer, at his lowest US Open seed since 2002 at seventh, advanced to a matchup with either US 26th seed Sam Querrey or Frenchman Adrian Mannarino.
Federer lost for the first time in 50 appearances in a Grand Slam second-round match last month at Wimbledon, falling to 116th-rated Sergiy Stakhovsky in his earliest Slam exit since the 2003 French Open.
"Just keep on winning. I don't care how," Federer said of his goals. "Right now it's about winning for me, trying to gain confidence and enjoy myself. I hope I can progress. We'll see how it goes."
Federer and Spanish second seed Rafael Nadal, a 12-time Grand Slam winner who captured his eighth French Open crown in June, could meet for the first time at the US Open in this year's quarter-finals.
"I hope I'm going to be there," Federer said. "The biggest mistake I can do is focus on Rafa right now. Clearly I would love a match with Rafa."
Nadal, unbeaten this year on hardcourts and a US Open favourite, makes his bid for a third-round berth later against Brazilian qualifier Rogerio Dutra Silva.
Spanish fourth seed David Ferrer and French eighth seed Richard Gasquet kept rolling toward a potential quarter-final matchup of their own.
Ferrer dispatched compatriot Roberto Bautista Agut 6-3 6-7 (5/7) 6-1 6-2 while Gasquet also ousted a countryman, dumping Stephane Robert 6-3 7-5 7-5.
World number one Williams, who would become the oldest US Open women's champion at 31 if she repeats, advanced her quest for a 17th Grand Slam title and fifth US Open crown by downing 77th-ranked Galina Voskoboeva 6-3 6-0.
Williams won the last eight games, breaking to capture each set, and advanced in 69 minutes.
"Galina played very well in the first set. You can see how much she has improved," Williams said. "But I played pretty well myself."
Yaroslava Shvedova, like Voskoboeva a Russian-born Kazakh player, defeated Austrian Patricia Mayr-Achleitner 6-2 6-3 to become the next Williams foe.
Errani, a semi-finalist last year, was ousted by one of her best friends and the 2012 French Open runner-up was in tears after falling to 83rd-ranked Flavia Pennetta 6-3 6-1 in 71 minutes.
"It was difficult," Errani said. "The worst thing was the 'fight'. Normally it's the best thing I do on the court and today it was not good. I don't know why. I think it's the pressure. Everything was very difficult for me."
Pennetta, a former world number 10, said the hardest part for her was facing a friend.
"We know each other really well," she said. "It's not easy to play against your friend so well but you have to get on the court and play your best."
Pennetta improved to 4-2 against Errani in their first meeting off clay, smacking seven aces and 33 winners. She next faces Russian 29th seed Svetlana Kuznetsova, the 2004 US Open winner who beat China's Peng Shuai 6-1 4-6 6-4.
"I never beat her. She's a really good player, a strong powerful player," Pennetta said. "She is also my friend, but you have to put that aside when you go on the court."
In another upset, Japanese qualifier Kurumi Nara advanced to the third round by defeating Romanian 19th seed Sorana Cirstea 7-5 6-1. Nara next faces Serbian ninth seed Jelena Jankovic, who beat Russian Alisa Kleybanova 6-3 6-2.
Two-time Australian Open champion Victoria Azarenka defeated Canada's Aleksandra Wozniak 6-3 6-1 in 68 minutes, the Belarus second seed booking a match against French 26th seed Alize Cornet for a spot in the last 16.
"I'm glad I got the first set," Azarenka said. "I was able to force the rhythm better in the second."