CAPE ELIZABETH — Alexi Pappas solved the mystery of the final arduous stretch of the TD Beach to Beacon 10K.

The answer was exhausting, leaving the 25-year-old from Eugene, Oregon, crumpled just past the finish line. It was also worth $5,000 and the prestige of being the first American woman to finish Saturday’s race.

“I’m really big on visualization and I felt like it was that last part of the race that was always a mystery to me,” Pappas said. “I knew what it would take at the end and that it might come down to that last stretch and I feel like it’s never been in me to outkick someone.

“I never wanted anything as badly in my life.”

Pappas finished in 32 minutes, 56.9 seconds, placing fifth overall and edging Liz Costello, 27, of Newton, Massachusetts (32:57.9).

Pappas, Costello and Laura Thweatt of Superior, Colorado, ran the first five-plus miles together, aware they were fighting for top American honors. Thweatt (33:18.4) fell back before entering Fort Williams, leaving the race to Pappas and Costello.

Costello had the edge until Pappas reached a point in the course she remembered clearly from when she walked the finishing stretch with her host family Friday. A five-time All-American at Dartmouth and Oregon, Pappas had finished 10th in 2013 and seventh in 2014 without walking the course.

“I looked at the finish yesterday and it was at that exact point and I knew: pick your legs up,” Pappas said, adding she had never previously beaten Costello or Thweatt. “I picked my legs up as much as I could. I knew I might (have to) dive across the finish line but I was going to do it.”

Costello earned $3,000 competing in her first Beach to Beacon a week after finishing fourth in the 10,000 meters at the Pan-American Games. She was enticed by the fact Beach to Beacon was offering prize money for the first time for top Americans.

“I would say that was part of it,” Costello said. “Along with the good competition and the fact that I’m now living in Boston makes it easier to get here.”

Pappas started a string of American women in the top 10, capped by Erica Jesseman, 26, of Scarborough, the first woman from Maine to finish in 34:52.5.

Jesseman was also the first Maine woman in 2013, when she just missed the course record for Maine women. Michele Lilienthal of Portland broke the Maine record in 2014 with a time of 33:39.5.

“My time was a little slow today but I just feel blessed to be out here today,” Jesseman said. “I was dying the last mile. I was a hurting puppy.”

Jesseman was also a happy pup when she found out she’d finished in the top 10 among all women.

Emily Durgin, 21, of Standish, who will be a senior at the University of Connecticut, was the second Maine woman in 35:01.8.

Durgin said she ran behind Jesseman for most of the race, trying to keep herself in check.

“Obviously I’m getting ready for the cross country season,” Durgin said. “My coach (at UConn) let me do the race. It was supposed to be a tempo run. I think I was pretty smart about it.”

Former Maine record holder Sheri Piers, 44, of Falmouth was the third Maine female finisher in 35:40 and overall women’s master’s winner (runners 40 and older). Piers said she appreciates the young talent in the state – sort of.

“When they pass you, you get mad at yourself,” she said. “And then you realize they’re 20 years younger than you.”