Sloane Stephens was two points from defeat against Venus Williams in one U.S. Open semifinal before pulling out the victory.
Madison Keys faced no such test, overwhelming CoCo Vandeweghe in the other semifinal.
Now Stephens and Keys, a pair of pals in their early 20s, will face each other in the first Grand Slam title match for each - and the first all-American women's final at Flushing Meadows since 2002.
Stephens summoned some of her best strokes when she needed them the most, steeling herself when so close to defeat and taking the last three games of a back-and-forth thriller, edging seven-time major champion Williams 6-1, 0-6, 7-5.
"I have a lot of grit," said the unseeded Stephens, who is ranked 83rd after having surgery on her left foot in January and is the fourth unseeded finalist at the tournament in the Open era, which dates to 1968. "I don't give up. Like, I'm not just going to give it to someone. I'm not just going to let them take it from me."
The 15th-seeded Keys, who dominated No. 20 CoCo Vandeweghe 6-1, 6-2 in barely more than an hour, had her own recent health issue to deal with: She missed the first two months of this year after an offseason procedure on her left wrist, then needed another procedure in June because of pain in that arm.
"I think I played pretty well tonight," Keys said in what amounts to quite an understatement.
She had 25 winners to only nine unforced errors, never faced a break point and needed barely more than an hour to win. That match time would have been even shorter, except Keys left the court to have her upper right leg taped at 4-1 in the second set.
This was the first time in 36 years that all four women's semifinalists at the U.S. Open represented the host country, so it was understandable if spectators in Arthur Ashe Stadium were conflicted about which players to pull for.
At 37, Williams was attempting to become the oldest woman to win a Grand Slam title in the Open era. She was trying to reach her third major final of this season, something she last did 15 years ago. Here's how long and successful her career has been: Williams' first title match in New York came in her U.S. Open debut in 1997. Stephens, now 24, was four at the time.
"I'm honestly just honored to be able to play at the same time as her, one of the greatest ever to play our game," said Stephens, who joined spectators in clapping for Williams when she walked off the court.
Williams was ahead 5-4 with Stephens serving at 30-all. Two points away.
"Venus knows it's an opportunity lost," said her coach, David Witt, "because she had it. She had it on her racket."
But with Williams two points away from winning, they engaged in a 25-stroke point, until Stephens conjured up a backhand passing winner down the line, then wheeled and pumped her fists.
"That was good, huh?" Stephens said later.
At 5-all, Stephens broke with the help of a rainbow of a winner - "That lob-thingy," she'd call it - that drew a standing ovation from the crowd, and a full-sprint get of a short ball that she turned into a "How did she do that?!" point-ender at an impossible angle.
"There was nothing I could do about those shots," Williams said.
Soon enough, Stephens was serving out the biggest win of her career - and of her impressive comeback from surgery. She returned to the tour at Wimbledon in July, losing in the first round, and lost her next match, too. Her ranking, which reached a high of No. 11 in 2013, dropped out of the top 900.
But since then, Stephens has won 14 of 16 matches.
"I mean Sloane is a new person right now," the 22-year-old Keys said. "I think she's really loving being back on the court again and she's just excited to be out here and playing really well."
Williams vs. Stephens was a back-and-forth affair, with a pair of lopsided sets leading up to a classic third. Just when it seemed one woman or the other was in full command, the match would swerve in a new direction.
They both hit the ball hard. They both covered so much ground, Williams getting to seemingly unreachable balls thanks to her long wingspan, Stephens doing the same thanks to her speed.
But it was Williams who faltered. She finished with six double-faults and a total of 51 unforced errors, 24 more than Stephens.
"I just wasn't playing well. Those are moments where you have to dig deep and figure out how to get the ball on the court and have a big game. I can't be tentative and try to figure out how to put that ball in," Williams said. "Clearly she's seen me play many, many times. I haven't seen her play as much."