"I was nervous, but I did my best, and I'm super proud of myself," Lee told reporters after the competition. "It's crazy. I didn't ever think I'd be here."
Lee's win is the fifth Olympic gold in a row for the United States in the individual all-around. Team USA's dominance in the sport was called into question after the Russians took gold in the team event two days ago.
Brazil's Rebeca Andrade took silver, winning the first ever medal for her country in women's artistic gymnastics. Angelina Melnikova, a veteran of the team from Russia, took bronze.
After her win, Lee smiled and hugged her teammate Jade Carey, who placed eighth.
After Biles withdrew, Lee, an 18-year-old from Minnesota, became the highest-qualifying U.S. gymnast for the all-around final. Each country is allowed to send a maximum of two gymnasts to the event.
Lee said that as she went into the final, she tried not to think about suddenly having a real shot at gold. "This whole season I've been second to her. So I just did what I do best, didn't focus on it, though, because I knew I'd get in my head."
Team USA called on Carey, who had the next-highest score in the qualifiers, to step in as the second U.S. gymnast. Carey, a 21-year-old from Arizona, took an unusual path to the Olympics – she qualified in individual international competitions and wasn't part of the four-member group that competed in the team event.
Carey came to Tokyo as an event specialist in the vault and floor exercise.
Twenty-four gymnasts took part in the all-around final, and each will compete in the four events: uneven bars, balance beam, floor exercise and vault.
Carey scored a 15.200 in a vault with a very high degree of difficulty — a tenth of a point behind Andrade.
Lee smiled after landing her vault and scored a very solid 14.600. Melnikova scored slightly higher than Lee with a 14.633. Their vaults had the same degree of difficult but Melnikova's execution score was better.
Lee has become famous for her exceptional uneven bars routines. She proved her skills in the event once again Thursday, beating all other medal contenders with a routine with the highest degree of difficulty. She scored a 15.300.
"I just told myself to just do what I normally do, because when I was kind of getting in my head, I was messing up my bar routine a little bit," she said later. "This week has not been easy on bars but I pulled myself together and I just stayed focused."
Derwael, Lee's chief rival on the uneven bars, scored just below her with a 15.266.
Carey fell during warmups for the uneven bars, and her competition score, 13.500, was the lowest of the top group.
Vladislava Urazova from the Russian team had the top score on the balance beam, at 14.200, but Lee delivered a strong enough routine to take the overall lead with a 13.833.
Carey fell off the 4-inch-wide balance beam during her routine and ended up with a score of 11.533, dashing her hopes of getting on the podium.
Lee's 13.700 floor routine was enough to seal her place in the history books. It wasn't the highest-scoring one of the night — that was from Japan's Mai Murakami — but it was what Lee needed to win gold.
The floor is not considered Lee's strongest event. She had not been slated to do it during the team final two nights ago but stepped in when Biles pulled out.
After the U.S. gymnasts won silver in the team event, Lee tweeted, "we do not owe anyone a gold medal, we are WINNERS in our hearts."
On Thursday, she proved that yet again, gold medal in hand.
NPR's Mandalit del Barco contributed to this report.
You won’t find a paywall here. Come as often as you like — we’re not counting. You’ve found a like-minded tribe that cherishes what a free press stands for. If you can spend another couple of minutes making a pledge of as little as $5, you’ll feel like a superhero defending democracy for less than the cost of a month of Netflix.