She initially struggled to get enough power behind her serve and missed several straightforward shots as French Open champion Ostapenko claimed the first set.
It was the first time Ostapenko had played against Williams, whom she described as her "childhood idol".
"The first match is always really hard after a break", Williams said.
Having shaken off some cobwebs, Williams then asserted herself, breaking four times to take the second set, with the highlight a crunching forehand return victor off Ostapenko's first serve that kissed the line and left her opponent helpless.
Date horror story: Woman rips pricey Andy Warhol artwork from walls
During court proceedings, court officials said, "She refused to leave the location, hid somewhere in his home". "I collect art. Authorities said she tore down several paintings and poured red wine on some while yelling obscenities.
Williams said after the 67-minute match at the Mubadala World Tennis Championship that she is still undecided on her title defence of the Australian Open, which starts January 15, but delivered a warning to rivals.
And while stepping out on the court is nothing new, stepping away from her child to do so certainly is. "I am going to assess everything with Patrick (Mouratoglou, her coach) and my team", she said.
Ostapenko is now entered at the 2018 Shenzhen Open, and their exhibition match will be held on 30 December, 5 pm local time. "But as the match moved on, I was less afraid", explained Williams.
Williams' problems with her serve continued, but she unleashed a few of her trademark double-handed shots on both sides to break Ostapenko twice at the start of the second set to go 3-0 up.
Liverpool announce deal to sign Virgil van Dijk from Southampton
The fee for Van Dijk, who joined Southampton from Celtic in 2015 for £13million, will be a world record for a defender. Van Dijk's first game is likely to be the FA Cup third round Merseyside derby with Everton.
The super tie-break was mostly a one-sided affair as Williams made unforced errors trying to be aggressive.
Williams again struggled with her serve in the second set.
"Of course, it is not going to be easy for me after such a great season but I have prepared well and I am just going to try to perform my best at the grand slams and try to stay inside the top-10".
Ravi Shastri says Team India not bothered about T20 cricket
Then what happens is you at least get to know who could be in the frame of things come 2019 (World Cup)", he explained. He has been around for five to six years now. "He understands his bowling which is so important", Shastri added.
The 14th-ranked Anderson immediately broke Bautista Agut and never looked in danger of losing his own serve in the opener.