Federer, the tournament's top-seeded, three-time champion, outlasted the 49th-ranked Serb 6-7 (5-7), 7-6 (7-1), 5-7, 6-1, 10-8 in a match that lasted nearly 4 1/2 hours, longest of the Swiss star's career.
"I don't often get to play five-setters unless they're against (Rafael) Nadal at Wimbledon," Federer said. "It was good to be part of something like this."
Federer is seeking his 13th Grand Slam championship
Rain at Melbourne Park forced third-round matches indoors at the Rod Laver and Vodafone arenas.
Blake lost the first two sets but rallied to defeat Frenchman Sebastien Grosjean 4-6, 2-6, 6-0, 7-6 (7-5), 6-2. Hewitt also came from behind to overcome Marcos Baghdatis of Cyprus 4-6, 7-5, 7-5, 6-7 (4-7), 6-3.
Other third-round winners included Novak Djokovic of Serbia and Marin Cilic of Croatia.