Defending champion Serena Williams ended a three-match losing streak against France's Alize Cornet to keep her hopes of a fifth Olympic gold medal alive.
But it was a rollercoaster 7-6 (7/5), 6-2 victory for the 34-year-old world number one who 24 hours earlier had suffered her first ever Olympic Games women's doubles loss with sister Venus.
Cornet defeated the American star three times in 2014, including at Wimbledon, and proved to be a thorn in her opponent's side again in Rio.
Williams led 3-0 and had two points for a 4-0 advantage in the first set. But Cornet stormed back, forcing the American to save two set points in the 10th game before the top seed sealed the tiebreak after 77 minutes on a chilly centre court.
Williams stepped on the gas in the second set to secure a third round clash with Ukraine's Elina Svitolina, securing victory on a third match point.
"It was a big motivation to win because I haven't done very well against her in the past," said Williams.
Juan Martin del Potro followed up his shock defeat of Novak Djokovic by downing Portugal's Joao Sousa in front of a legion of passionate, vocal Argentine fans.
The giant 27-year-old, ranked 141 in the world after years of wrist injury misery pushed him to the brink of quitting, swept to a 6-3, 1-6, 6-3 win.
Dressed in sky blue football shirts, the Argentine's followers draped national flags and banners over the centre court barriers and responded defiantly when locals booed the mention of del Potro's name.
Djokovic suffered a second Olympic defeat when he and Nenad Zimonjic were knocked out of the men's doubles. The Serb pair lost 6-4, 6-4 to Brazilian fourth seeds Marcelo Melo and Bruno Soares.