Federer returned to stadium court on Sunday afternoon and needed an hour to close out his second-round victory 6-3, 7-6 (8/6).
“It's been a long time since I have been interrupted at night and have to come back the next day,” Federer said.
His title defence got off to a soggy start Saturday night when play was suspended because of rain showers with Federer up a set and tied 2-2 in the second.
The clouds rolled in just before the start of their match on Saturday and after a short delay to start the first set they managed to play until the skies blackened and the heavy rains came in the second. After another 90-minute delay organizers suspended play for the night.
Federer is making his 17th appearance in the California desert and is assured of remaining world number one if he makes it to the semi-finals.
He extended his 2018 win streak to 13 matches and has only dropped three sets from 34 played this year.
Federer hit five aces and won 74 percent of his first serve points in the match which took a total of one hour and 41 minutes over the two days.
He will face 25th-seed Filip Krajinovic in the third round.
Federer and 10th seed Djokovic both came into the tournament seeking to become the first six-time winner of the event.
But Djokovic fell at the first hurdle with a shock loss to Japanese qualifier Taro Daniel, who sent the out-of-sorts Serb tumbling with a hard-fought 7-6 (7/3), 4-6, 6-1 victory.
It was another snag in the return for world number 13 Djokovic, who admitted he lacked composure while playing in just his second event of 2018 and first since having surgery.