Maria Sharapova kept her US Open run going but was pushed all the way by Timea Babos.
After her epic first-round victory over second seed Simona Halep, Sharapova was being touted by some pundits as a potential title contender.
But she looked much more like a player who has played just one match since May in the first set against Babos, a Hungarian ranked 59.
Sharapova did not play nearly as freely as she had against Halep, when the pressure was largely on her opponent, but her famous fighting spirit was in evidence as she battled to a 6-7 (4/7) 6-4 6-1 victory.
"From the moment that I've been here, I've really understood what this means to me, to be back."@MariaSharapova advances to R3!#USOpen pic.twitter.com/hcQ8ZamRzA
— US Open Tennis (@usopen) August 30, 2017
Babos came into the tournament in poor form having lost 12 of her last 14 matches, including nine in a row between the Istanbul Cup in April and the Rogers Cup earlier this month.
But she capitalised on Sharapova's tightness, tempting the five-time grand slam champion to go for big shots off sliced forehands down the middle of the court.
Sharapova was simply not landing the shots she had on Monday night, when she made a stunning return to grand slam tennis following her 15-month doping ban.
Babos twice missed the chance to serve for the opening set but took it anyway on a tie-break, and then had two break points for a 4-2 lead in the second set.
That was to prove the turning point. Sharapova saved both, broke Babos in the next game and did not look back, racing through the third set.
The big question remains how the 30-year-old's body will hold up after so little tennis, and she had tape on her left forearm.
But she will be a big favourite to at least make it through one more round, with her next opponent either Sofia Kenin or Sachia Vickery.
Sharapova said: "It was definitely tough to control the emotions yesterday, because as much as you want to be happy about the match and what I accomplished there, you want to move on fast.
"Finding that balance is hard. I just wanted to get it done today, and I did. It wasn't my best tennis. I felt like it was a scrappy match but some of those days can be the best, when you get through and give yourself another chance.
"Every day that I have another chance to play out here at the US Open is a special day."
Eugenie Bouchard's miserable form continued with a 7-6 (7/2) 6-1 defeat by Russia's Evgeniya Rodina in the first round.
The 23-year-old Canadian has won just two of her last 10 matches and had little answer when asked what had gone wrong.
"I don't really know, to be honest," she said. "It's one of those matches you kind of want to forget about. I know obviously the unforced error count was a bit too high, especially at the end of that first set. I just didn't really know what to do out there."
Bouchard reached the Wimbledon final in 2014 but slumped alarmingly the following season and has been unable to halt the slide.
Now ranked 76, even she was surprised to find her match against unheralded Rodina scheduled on the biggest court in tennis, Arthur Ashe Stadium.
The legal action Bouchard took against the United States Tennis Association two years ago, meanwhile, has still yet to be resolved.
Bouchard suffered concussion and had to withdraw from the US Open ahead of her fourth-round match against Roberta Vinci after slipping over in a physiotherapy room. She did not complete another match that season.
"I'm able to concentrate on the tennis when I'm here but I definitely have bad memories from here two years ago," she said.
Two of the eight players vying to be world number one at the end of the tournament came through three-set tussles in round one.
Fourth seed Elina Svitolina resumed her match against Katerina Siniakova after rain had suspended play in the second-set tie-break on Tuesday and eventually prevailed 6-0 6-7 (5/7) 6-3.
Eighth seed Svetlana Kuznetsova came much closer to exiting the tournament, saving three match points in a 4-6 6-4 7-6 (7/2) victory over Marketa Vondrousova.
Title favourite Garbine Muguruza did not begin her match against Duan Ying-ying until gone 10pm local time, such was the packed nature of the schedule follow Tuesday's rain.
But the Wimbledon champion wasted little time once she did get on court, defeating her Chinese opponent 6-4 6-0. Muguruza has lost just seven games in four sets in her opening two matches.
Ninth seed Venus Williams, playing in the night session, was safely through to round three well before Muguruza took to the court, beating France's Oceane Dodin 7-5 6-4.
RD. 2 ✔️ pic.twitter.com/YfhiArbKdc
— Sloane Stephens (@SloaneStephens) August 31, 2017
In a very open section of the draw also featuring Sharapova, American Sloane Stephens continued her fine comeback from a year out with a foot injury by upsetting 11th seed Dominika Cibulkova.
Petra Kvitova has struggled in recent weeks but has hit form at a venue where she has faltered in the past and the 13th seed easily dispatched Alize Cornet 6-1 6-2.
But the final match of the day produced a shock, with fifth seed and two-time finalist Caroline Wozniacki losing 6-2 6-7 (5/7) 6-1 to Ekaterina Makarova.
It was a horrible draw for Wozniacki against the in-form Russian, who looked like she might have blown her chance when she failed to serve out the match in the second set.
But Makarova regrouped to race through the third, putting Wozniacki out of contention to become world number one at the end of the tournament.