NEWBURYPORT — You couldn’t have scripted it any better.

Newburyport and Swampscott girls lacrosse had battled tooth and nail for nearly 50 minutes in a game where neither team ever led by more than two. The Clippers were without Maggie Pons, the Cape Ann League’s leading scorer who had gone down with a serious looking knee injury before halftime, and with under two minutes they trailed the Big Blue by a pair.

That’s when Sam King went to work.

The All-CAL sophomore had the game of her life, scoring twice late to force overtime before coming through with the game-winner, sealing a thrilling 14-13 win in the Division 2 North semifinal in front of the home crowd at Newburyport High School. King finished with seven goals, including Newburyport’s last six, to clinch a third consecutive trip to the North Finals.

“That was just a dream come true,” King said. “Ever since I was little I was like ‘I want to play for Newburyport varsity lacrosse, and I want to score the game-winning goal,’ and today I did that.

“Every day our team plays to win another game and we rise to the occasion, we scooped ourselves out of the hole that we built for ourselves, and we came up with it,” she continued. “We rose, that’s our slogan, we rose, and we’re just going to keep on rising.”

King’s heroics capped off a white-knuckle game that featured 21 ties or lead changes by the time all was said and done. Even before the final surge, King scored two quick goals midway through the second half to erase an earlier two-goal deficit, and despite some disjointed play down the stretch, the Clippers got key contributions from across the lineup to help get over the hump.

For instance, King’s late goals wouldn’t have been possible had it not been for a pair of crucial draw control wins by freshman Isabel Hulse, who got Newburyport possession in the final minutes when Swampscott could have ran out the clock had they gotten the ball.

Junior defender Samantha Cavanaugh also had a monster game, and sophomore goalie Erin Osinski came up with a huge save in the final minute to deny the Big Blue of a potential game-winner. Once in overtime, the Clippers forced a turnover and avoided giving it back after sophomore Laney Lucci weaved her way through a jungle of defenders at midfield. That led to a feed to Hulse, who hit King in stride for the game-winning goal.

Newburyport coach Catherine Batchelder said the final sequence of regulation was exactly the sort of situation the team has worked all season to prepare for.

“We practice situations all year where we give them that exact scenario and they have to come back and score twice. There’s usually a consequence on the line, so they’re used to that situation,” Batchelder said. “When we called timeout we talked about it, Isabel Hulse came up with huge draw controls for us, which gave us the opportunity to even try to score, and they did a great job. They completed it, it’s a great finish.”

Newburyport and Swampscott went into halftime tied 7-7, though just before the break the game took a turn for the serious after Newburyport’s Pons went down with a knee injury and was unable to put any weight on her left leg as she was helped off. Pons scored five goals prior to her injury, putting her at 103 goals on the season, and while the loss clearly affected the Clippers, they had no choice but to move forward.

“As hard as it is, we have to put it aside,” King said. “We have to keep the game in front of our mind, and always Maggie will be here for us and we’re going to keep playing for her, and we’re hoping for a quick recovery.”

Swampscott was led offensively by Emerson Laundry (six goals), Harper Clopton (three goals) and Grace DiGrande (three goals). Katie Hadden had Newburyport’s remaining two goals.

Newburyport (15-3) will now advance to the Division 2 North Final, where the Clippers will host CAL rival Manchester Essex at Newburyport High School on Friday. Swampscott finishes the season 16-3.

Newburyport 14, Swampscott 13

Division 2 North Semifinals

Goals: N — Sam King 7, Maggie Pons 5, Katie Hadden 2; S — Emerson Laundry 6, Harper Clopton 3, Grace DiGrande 3, Elizabeth Green

Assists: N — Emily Fuller, Liberty Palermino, Ashley McIntire, Isabel Hulse, Hadden

Saves: N — Erin Osinski 8

Swampscott (16-3): 7 6 0 0 0 — 13

Newburyport (15-4): 7 6 0 0 1 — 14