Playing in his fourth tournament of the year, and second hard-court event in preparation for the US Open later this month, Murray was edged out 6-1 1-6 6-4 in Cincinnati.
He has missed the last two editions of this tournament because of injury.
The 23-time grand slam victor hit 27 winners to steamroll the world No 23 Gavrilova and bounce back from the most lopsided loss of her career two weeks ago - 6-1, 6-0 to Johanna Konta in San Jose - to set up a meeting with Czech eighth seed Petra Kvitova in the second round. "In the first set he had a really good serve and big forehand but I was just trying to stay strong all the time and stay calm as well". 'I think I knew what I had to do. "If I can improve by 10, 15 percent, you turn a lot of those matches around". It's a good thing.
"You've got to keep it all in perspective, it's easier now for me to take time away".
After a first-round bye, Federer extended his Cincinnati winning streak to 11 matches since losing to Rafael Nadal in the 2013 quarterfinals.
Eighth seed Dominic Thiem was forced to withdraw without hitting a ball.
Nick Kyrgios served 39 aces, including one to save match point, to power into the second round with a dramatic 6-7 (2/7), 7-5, 7-6 (11/9) win over Denis Kudla.
The Australian will next face Croatian Borna Coric, who beat Daniil Medvedev 6-2, 6-3.
Williams also was knocked out in her last tournament at San Jose two weeks ago after reaching the Wimbledon final. "I started the year very well".
"I'm very happy, especially with the way I fought until the end", he said.
No 11 seed David Goffin advanced with a 7-5 6-3 win over Stefanos Tsitsipas, and Leonardo Mayer became the first player to reach the third round on the men's side with a 7-6 (7) 6-4 victory over 16th-seeded Lucas Pouille.
"Watching from afar is tough", said Federer, who will start against Peter Gojowczyk after the German beat Portugal's Joao Sousa 2-6, 6-4, 7-5. "I was so happy when I won the first set because I thought, 'Finally, one set for me'".
Elise Mertens scored a 6-4 6-2 first-round win over Magdalena Rybarikova.
For more sports coverage, visit the ABS-CBN Sports website.
- She Shot Off Her Face. Now She Has a New One
- Ramos: "Real Madrid won't stop winning because Ronaldo left"
- Samsung's Galaxy Note 9 is stopgap ahead of major revamp, say analysts
- Cardinal Wuerl Responds to Criticism After Release of Grand Jury Report
- Wallabies captain Hooper cleared for Bledisloe opener
- Bayer Has a Reason to Feel Monsanto Buyer’s Remorse
- Gov. Scott Issues Emergency Order for Red Tide
- Jimmy Fallon throws up during drinking game with Ryan Reynolds
- Juventus Deal-Maker Could Consider Offer To Join Manchester United
- Stranded Parrot 'Turns Air Blue' Cursing Out Firefighter During Rescue Attempt