PORTLAND, Maine — To say that Emily Keene is a perfectionist is a matter of both principle and performance, especially when she’s standing at the free throw line.

A year ago, Keene was startlingly close to perfect when she swished 49 of 50 free throws to win the annual McDonald’s All-Star shootout. So when the Spruce Mountain junior missed not one, not two, but three straight Wednesday morning to let Fryeburg stay in a Class B West girls’ basketball quarterfinal to the finish, her agony and disbelief were palpable.

Of course, as perfectionists are prone to do, Keene buttoned everything up before it unraveled. She sank six straight from the line in the final 71 seconds of the regulation, and the No. 2 Phoenix made 9 of 10 to lock up a 55-51 victory over the No. 7 Raiders.

“I had a chance and missed some big ones that could have put it away,” Keene lamented.

But all’s well that ends well, and this so-far-spotless season is far from over. Spruce Mountain (19-0) advanced to the semifinals for the first time in school history and will meet No. 3 Wells at 3 p.m. Thursday at Cumberland County Civic Center.

Keene led the Phoenix with 18 points. Kailee Newcomb added nine and Sam Richards had eight, while Nicole Hamblin combined six points with seven steals.

“It’s a big step for us,” said Spruce Mountain coach Gavin Kane. “We don’t have a lot of time obviously to think about it or get excited about it.”

Skye Dole scored 15 of her 18 points in the second half for the Raiders, mostly by way of the offensive glass. Mackenzie Buzzell and Alexis L’Heureux-Carland each had nine points.

Spruce Mountain never trailed, catapulting to a 6-0 lead on the strength of baskets by Richards, Keene and Alex Bessey and its customarily smothering pressure.

Fryeburg battled back to tie it three times in the first quarter. Three points off the bench from Emily Hogan kept the Phoenix afloat during a brief offensive lull, and a Hamblin 18-footer put Spruce Mountain in front to stay with 48 seconds remaining in the period.

“Just try to stop them early and get on them defensively and score some baskets to get the lead up,” Newcomb said of the game plan.

The Phoenix overcame a 2-for-10 skid in the second period to stay in front 25-20 at the half, then inflated that lead to its maximum of 11 midway through the third.

Hamblin’s steal led to a Newcomb basket, and Vanese Barnes cashed in her own theft in the backcourt to trigger the run. Newcomb’s 3-pointer from the right corner pushed it to the high-water mark of 38-27.

“They don’t go deep into their bench, so we were also hoping with our pressure that we could wear them down,” Kane said. “At times we were effective with it, and there were other times we fell asleep with it ball-watching.”

Spruce Mountain went the final four minutes of the quarter without a field goal. Two late, inside buckets by Dole cut the gap to 39-33 and foreshadowed the Phoenix’s fourth-quarter difficulty putting it away.

Dole had nine points and Buzzell six in the fourth. McKenna Gerchman’s 3-point bomb made it 50-47.

“I feel like a lot of it might have been nerves,” Newcomb said. “At times breaking down, letting them back in the game, I think that was the hardest thing. Trying to get everyone going the whole game.”

After a miss and a make from the line by Newcomb, a Buzzell putback got the Raiders within two at the 16-second mark.

Keene and Richards closed the door with four straight from the line.

“I thought we had a couple of opportunities to create a little distance and make it a little more comfortable down the stretch,” Kane said. “That’s a credit to Fryeburg, too. They made some plays. [Gerchman] hit an NBA 3. [Dole] is a load inside. She’s tough to defend. I’m a little disappointed that we didn’t come down and get one or two stops earlier.”