The sluggish play that blighted the six-time winner's first week at the tournament was nowhere to be seen during the 6-3 6-2 6-3 win over the 16th seed.
Defending champion Federer needed only one hour and 24 minutes to secure his 25th successive grand slam quarter-final appearance.
The number one seed had faltered in the early rounds, dropping sets against Alejandro Falla and Ilija Bozoljac, but now appears to be back to something approaching his grass-court best.
Melzer, playing in his maiden fourth-round match at the All England Club, made a bright start when securing an early break of Federer's serve.
But the Swiss maestro quickly hit back with a break of his own before Melzer dropped serve a second time to hand Federer a decisive first-set advantage.
The 16-time grand slam champion was not troubled on his serve again, with the pressure constantly being put on the 29-year-old left-hander.
The strain proved too much as Federer gained a double break in the second set as he dispatched Melzer's serve for a series of winners.
Federer finished off the set before earning another break in the third. The world number then went on to serve out the match and set up a last-eight clash with 12th seed Czech Tomas Berdych, who later beat Daniel Brands of Germany 4-6 7-6 (7-1) 7-5 6-3.
Federer believes that his performances are improving as this year's Wimbledon tournament wears on.
"This is a very good win for me," he said after the match.
"I think the start to the match was vital and I got the early break. He was able to break back but I had already found my range and I was playing well so I was very happy with the way I played.
"Obviously opponents are now getting more and more difficult but I think my game's following it up."