It took some time, but Coco Gauff eventually took to Flushing like she took to London, surviving a two-hour battle Tuesday.

After a shaky start, Gauff gathered herself and emerged victorious in her U.S. Open debut. After falling down a set and an early break, Gauff wore down 72th-ranked Anastasia Potapova for a 3-6, 6-2, 6-4 triumph before an adoring crowd at Louis Armstrong Stadium, after which she celebrated with glee.

“I think I gave my mother a heart attack and my father looked tired too,’’ Gauff said in her on-court interview.

As expected, the fans were screaming their support for the 15-year-old American, who received a wild-card entry into the main draw after a stunning run into the fourth round at Wimbledon last month.

She became the first player since fellow American CiCi Bellis in 2014 to win a main-draw match before her 16th birthday.

The Teen Vogue cover girl’s will to win — which has been trumpeted by many tennis insiders — clearly was in evidence as she kept bouncing back from every adversity she faced during a day-card match that leaked into the night session.

Gauff committed 10 double faults — eight in the first two sets.

“She showed a fighting spirit,’’ her father and coach, Corey Gauff, told The Post. “When things are not going well, you kept fighting through. She didn’t play well, but she played intelligently and stopped hitting it into her strike zone, keeping it low.’’

Gauff said she felt she couldn’t have done it without the Armstrong fans.

“Honestly, it’s because of the crowd,” Gauff said afterward, addressing her supporters. “You guys were amazing. No matter where I was on the court, I could hear somebody supporting me. Obviously I was nervous going onto the court and it’s my home slam, so I wanted to do well.’’

Gauff, ranked 139th, had to qualify for Wimbledon and then faced Venus Williams in the first round. The Delray Beach, Fla., product had some support in England, but she admitted Venus had more.

At Armstrong, the fans chanted “Co-co’’ in the final set. “This is my first match where people actually had a chant for me,’’ she said.

Papa Gauff, wearing his white “Call me Coco” T-shirt, said he is attempting to limit expectations here. Just a year ago, Gauff lost in semifinals of the junior event.

In Tuesday’s first set, Gauff looked all of 15 and couldn’t handle the windy conditions. Although Potapova is just 18, that does give her three years on Gauff, whose father could be seen standing and cheering wildly.

“Technically on paper she’s the underdog,’’ Papa Gauff said. “That girl [Potapova] had as good a junior career as Coco.”

Asked the difference between this visit to Flushing Meadows and last year’s, Papa Gauff said, “We don’t have to ride the subway or take a [bus] shuttle here.’’

Coco, who could meet defending champ Naomi Osaka in Round 3, is loving the fame.

“What I do on the court is great,” she said, “but what really matters is what happens off court, the people you affect.’’

Gauff’s rocketing game punished Potapova so badly in the third set, the Russian conveniently called for a medical timeout as trainers looked at her right arm. Gauff was up 4-1 at the changeover. Following the respite, the hard-hitting Russian rallied to bring it back to 4-4.

At 4-4, 30-30 in the third set, Gauff pounded a service winner wide to Potapova’s forehand, then won that game to go up 5-4 and broke her serve to close it out on a long rally. As the match wore on, Gauff captured a majority of the longer rallies.

“Honestly, I just wanted to win so bad,’’ she said. “I was trying to really dig deep.’’

Gauff was broken in her first service game, double-faulting three times. She fell behind 3-0 and 5-1 and seemed frustrated by three early challenges made by her opponent — two of which Potapova won.

“She was trying to really go for it,’’ Papa Gauff said. “She’s an aggressive server.”

While Gauff showed some electric strokes early, too often she powered balls well long or mishit a few others. Things didn’t go well to start the second set, when Gauff double-faulted on the first point, hit a backhand long and a forehand into the net to get broken.

After that, however, she showed her athleticism, touch, range and defensive smarts as the fans cheered the American’s every move. Potapova got tight and became erratic.

“She’s a problem-solver,’’ said a person close to Coco. “She figures it out.’’