TOKYO — As Sunisa Lee and the other gold medal contenders walked to their final rotation, the 18-year-old from Minnesota knew what she needed. This Olympic all-around gymnastics final had become such a tight race that one extra step, a shaky landing or any minuscule error could make the difference. And so she needed 90 seconds of poise to win the gold medal in her sport’s signature event.

Lee understood what this meant to her country, her family and her community. All those pressures that double as inspiration converged when she performed the most important floor routine of her life. Despite a foot injury that just a few months ago left her wondering whether she would make it to the Games, Lee executed each skill with precision to move atop the standings. And then she had to wait because Brazil’s Rebeca Andrade still had a chance to climb ahead. With the gold medal at stake, Andrade bounced out of bounds twice. Those deductions changed the outcome, and when Andrade’s score appeared, Lee hugged her coach, Jess Graba, in tears.

“She’s tough as nails,” Graba said. “People don’t see that. They don’t know how hurt she is. They don’t know how stressed out she is. They don’t know how nervous she is.”

Yet Lee handled that load in the most intense of circumstances. Team USA needed a new gold medal contender after Simone Biles, the heavy favorite to repeat as the Olympic all-around champion, withdrew from the final. Lee, already eyeing a medal even if Biles had been on the floor instead of in the stands, felt the weight of that task but rose to the occasion. Her all-around score of 57.433 edged Andrade by less than two-tenths of a point, and she kept the Americans’ gold-winning streak intact.

U.S. gymnasts have won the all-around gold at every Olympics since 2004, when Carly Patterson earned the title in Athens. Americans have won the top individual honor at every world championships and Olympics since 2011, a streak that Biles has fueled with golds at five world championships and in Rio de Janeiro in 2016. With Biles sidelined as she works through mental health challenges — replaced in this competition by Jade Carey, who finished eighth — Lee took on a new role. She became the team’s best hope.

“Coming into this competition, I didn’t even think that I could be competing for a gold medal,” said Lee, who has previously noted how competitions with Biles feel like a chase for second place. “I was coming to compete for a silver medal. To be here is just crazy.”

After her performance, Lee talked with her parents via FaceTime. She said, “I did it!” And then they all cried.

Lee wanted to win this for her dad, John, because, she said, “This is our dream.” They had always said that if she won a gold medal, he would come down to the floor and they would do a backflip together. But they wouldn’t have been able to fulfill that part of their vision, even if parents had been permitted inside Ariake Gymnastics Centre.

Lee’s father fell from a ladder and suffered injuries that left him partially paralyzed two years ago, just days before his daughter traveled to compete in the U.S. championships. That turned into a breakout meet of sorts for Lee, who finished second to Biles and has since maintained her position as the United States’ second-best all-arounder. As she ascended to become one of the world’s best gymnasts, Lee repeatedly cited her dad as an inspiration and the person whose pep talks before meets ease her nerves.

“My parents are just the most amazing people in my life,” Lee said.

Lee’s family watched with a crowd of supporters at a community center near their home in St. Paul, Minn. Her father, who uses a wheelchair, lifted his fist in celebration the same way Lee did after receiving her medal. He was surrounded by dozens of others who understood what this achievement meant. As the first Hmong American to make the U.S. Olympic team, Lee hopes her victory inspires the Hmong community. She said she wants others to push for ambitious goals, too.

“I want people to know that you can reach your dreams,” Lee said as she placed her hand on her gold medal. She said sometimes people in the Hmong community feel restricted in what they can accomplish, “but I feel like I proved that when you do put your heart into it, you can do something great with it.”

Lee’s excellence is rooted in her ability to shine under pressure with quick thinking. Lee has two versions of her routine on bars, her standout event. Which one she performs depends on how perfectly she catches a particular release move. In the all-around final, she managed the hardest variation, which has the highest difficulty value in the world. If Lee had performed the other routine — which is still wildly tricky but has a slightly lower value — her all-around total wouldn’t have been enough for the gold. Hitting that routine, Lee said, was critical in her climb toward the top of the medal podium.

Just after Lee began her beam routine, she leaned way back and wobbled on a turn performed in a squatted position. A fall there would have knocked her out of the medal race entirely. She stayed cool and finished the routine without another major error. When the highest-seeded gymnasts transitioned to floor, their final apparatus of the evening, the top four competitors had scores within five-tenths of a point of each another.

In the absence of Biles, “there was a mystery who will be the champion,” bronze medalist Angelina Melnikova of the Russian Olympic Committee said through an interpreter.

Before Lee traveled to Tokyo and became the gymnast who earned that crown, at times she wanted to quit — both during the early days of the pandemic and when she suffered that foot injury. “It just wasn’t getting any better,” Lee said, “and it just felt like I wasn’t ever going to be able to make it to the Olympics.”

Lee limped through competitions a couple of months ago and then performed a downgraded floor routine at the recent U.S. trials. She gradually returned to full strength, but in the all-around final, Lee and her coach opted for a routine with three tumbling passes instead of four. It worked. Lee finished each one with a secure landing.

Moments later, her score confirmed she had surpassed Melnikova. Then Andrade’s mark wasn’t enough for the gold, though her silver made her the first Brazilian to medal in women’s gymnastics.

Lee had won. Biles and the other U.S. Olympians watching from the stands jumped to their feet in celebration. Her family, awake in the early morning hours back home, rejoiced. And then Lee took a deep breath on the podium as her eyes welled with tears.

“I didn’t think,” Lee said, “I would ever be here.”