Serena's hard-fought victory gave the United States a 2-0 advantage.
Williams' experience and savvy ways showed in critical moments against the 22-year-old Ostapenko as she prevailed 7-6(4) 7-6(3) in a match that took one hour and 46 minutes.
“I’ve played in front of so many crowds but I don’t think I’ve ever played in front of a crowd this loud,” Serena said after the match.
Her victory followed compatriot and Australian Open champion Sofia Kenin’s easy 6-2 6-2 win over Anastasija Sevastova to give the Americans the lead heading into Saturday.
With Williams up a set, the 23-times major champion and Ostapenko held service through a 5-5 tie in the second. Williams capitalised on Ostapenko's errors to finally break ahead 6-5 before her own miscues forced another tie break.
Down 2-0 in the tie break, Williams ran off five straight points, including a forehand winner to move ahead 5-2, to take control and ultimately prevail.
It was not the cleanest match for Williams, but she benefitted from Ostapenko’s 47 unforced errors.
Earlier in the day, Naomi Osaka's return to Japan's Fed Cup team after a year's absence turned sour as the world number 10 suffered a thrashing at the hands of Spain's Sara Sorribes Tormo.
The two-time Grand Slam champion was expected to give Japan a huge boost in their bid to overcome five-time champions Spain at the La Manga Club near Murcia, but lost 6-0 6-3.
Osaka, whose Australian Open title defence was ended by 15-year-old Coco Gauff, looked ill at ease on the clay as she racked up 50 unforced errors against the world number 78 who claimed only a second Fed Cup singles win.
"Honestly, it wasn't even a match," am emotional Osaka said.
For me I'm kind of dealing with some stuff and I couldn't mentally get into the match. It's sort of... my fault.
Claycourt specialist Carla Suarez Navarro, playing in her last home tie for Spain, then beat Misaki Doi 6-3 6-4 to put Spain 2-0 ahead going into Saturday's reverse singles.
Spain need to win just one of Saturday's three rubbers to book their place in the inaugural Fed Cup Finals featuring 12 nations in Budapest in April.
Holders France, runners-up Australia, wildcards Czech Republic and hosts Hungary will definitely be involved in the revamped event, leaving eight others to book their places in this weekend's qualifiers.
Switzerland are well-placed after moving 2-0 ahead in their tie against a much-weakened Canada side in Biel.
The Netherlands and Belarus were locked at 1-1 with Aryna Sabalenka levelling the tie after Kiki Bertens had put the Dutch ahead with victory over Aliaksandra Sasnovich.
Romania were without Simona Halep in Cluj but ended day one level at 1-1 with four-time winners Russia while Belgium were also locked at one apiece with Kazakhstan.
Germany are in the driving seat in Brazil after wins for Laura Siegemund and Tatjana Maria in Florianopolis.