Federer struggled with a back problem in the first set and left Centre Court for a medical timeout of more than eight minutes when leading 4-3, but came back to secure a 7-6 (1), 6-1, 4-6, 6-3 victory over the Belgian.
Federer said he thought he was in trouble at first but that the back started feeling better as the match went on.
Still, he was down 2-0 in the fourth set as Malisse threatened a comeback but he recovered to win the next five games.
In the third round, the six-time champion rallied from two sets down to beat Julien Benneteau.