The 23-time Grand Slam champion defeated 2017 French Open winner Ostapenko 7-6 (7-4) 7-6 (7-3).
That came after newly-crowned Australian Open champion Sofia Kenin beat Anastasija Sevastova 6-2 6-2 in the first rubber.
“It’s been a long journey. It wasn’t easy,” said world number seven Kenin.
“But I was super happy to come here and play with the team.”
Williams added: “I’m really proud of being able to get the win for the team. I’m really excited that I was able to go through it.”
The qualifier, taking place in Everett, Washington, continues from 23:30 GMT with Kenin taking on Ostapenko in the third rubber.
The winners of the best-of-five tie will be one of 12 nations in April’s new-look Fed Cup Finals.