Federer delivered a Centre Court masterclass lasting 89 minutes as the Swiss star hit 48 winners and 16 aces in his 6-4, 6-4, 6-1 victory.
The 36-year-old is now on his joint second longest streak of sets won at Wimbledon – his best was 34 between the third round in 2005 to the 2006 final.
Next up for Federer is a third round tie against 39-year-old Croatian Ivo Karlovic or German world number 64 Jan-Lennard Struff.
In his 20th Wimbledon appearance, top seed Federer, a 20-time major winner, is bidding to become only the second player to claim nine singles titles at the All England Club after Martina Navratilova.
On the evidence of his ruthless demolition of Slovakian world number 73 Lacko, it will take something special to stop Federer making more Wimbledon history.
“I played very well. I felt good out there, less nerves than in the first round,” Federer said.
“I'm happy how I am hitting the ball, good concentration on my service games and able to mix it up with some slices.
“Of course, you sometimes play the percentages, but if you do that too much it becomes boring, so I like to mix it up.
“I clearly enjoy the path more where it comes easier, not wasting too much energy is always nice,” he said.