The 23-time Grand Slam champion, who is warming up for the Australian Open, was at her dominant best after a slow start in which she saved four break points in the opening game of the contest at Margaret Court Arena.
Former world number one Williams has not played since withdrawing from last year's French Open second round in September with an Achilles injury, but made quick work of Gavrilova, striking 27 winners including 16 in the opening set.
"It feels good to be back here," the 39-year-old Williams, who is chasing a record-equalling 24th major, said in an on-court interview. "I felt I was definitely composed and in a zone and trying to do the things I've been working on."
Up next for Williams is Bulgarian Tsvetana Pironkova, who she was due to face at Roland Garros before her injury.
The tournament is one of six arranged by Tennis Australia before the Australian Open, which begins next Monday.