SOUTH PORTLAND — Yarmouth’s volleyball team had a Gold Ball within sight Friday night, but defending champion Cape Elizabeth was doing everything in its power to keep it.

So prior to the biggest set of their lives, the Clippers took the floor and danced.

And 15 points later they danced again to celebrate a Class B state championship.

Second-seeded Yarmouth won the first two sets at Beal Gymnasium, 25-17 and 25-18, but the top-ranked Capers came back to take the third game 25-18 and the fourth 25-23, setting up a winner-take-all fifth set.

After dancing their nerves away between sets, the Clippers led almost the whole way and took the decisive game 15-11 and the match 3-2 to finish on top of the Class B world.

“We danced to the music and loosened up, and took a deep breath and calmed our nerves,” said Yarmouth hitter Maggie Murray, who had nine kills and seven blocks. “We just really wanted it.”

The Clippers (15-2) won the Class B title for the fourth time (2011, 2013, 2014) but it was their first under the current three-class format.

“I’d be lying if I said this wasn’t a very special win for us,” said Yarmouth Coach Jim Senecal. “It means so much to us because we’re playing the best teams in the state regardless of class.”

Cape Elizabeth found itself behind almost immediately when the Clippers took the first set 25-17, erasing a 15-13 deficit with a 10-0 run.

In the second game, another Yarmouth run, this one 8-1 after falling behind 10-6, helped push the Capers to the brink.

The Clippers threatened to end the match in three games when they went up 15-10 in the third game, but Cape Elizabeth rallied, taking the lead on an ace from Julia Torre and winning 12 of 13 points in one stretch before finishing it off on a kill from Megan Connelly, her fifth of the set.

Yarmouth got even closer to the title in the fourth set, opening a 16-9 lead, but again Cape Elizabeth answered and closed the game on a 8-3 run to set the stage for a dramatic finish.

The Capers got the first point of the fifth game but the next four went to the Clippers. Kills from Murray and Kaitlyn Bennett, and a couple of Caper mistakes made it 12-4.

Again Cape Elizabeth rallied, pulling within 13-10 on a Connelly ace, but after the teams traded service faults, setter Dominique Moran set up Evelyn Lukis for the kill that ended it.

“Dominique put it right there and I was so happy,” said Lukis, who finished with 19 kills. “I’m really proud of what we accomplished.”

For Moran (36 assists), the title was the culmination of a four-year quest.

“It’s more emotional than I thought it would be,” Moran said. “We did what we had to do and got it done.”

Seniors Skyler Bennett, Marie LeBlanc and Ceanne Lyon also played key roles in the Yarmouth victory.

Despite 13 kills from Connelly in her final match, 27 assists from setter Corina Page and strong serving from Torre (five aces), Aerin Manning and Kalie Manning, Cape Elizabeth (15-2) wasn’t able to repeat.

“We fight and win or lose, we leave everything on the court,” said Capers Coach Sarah Boeckel.

“Yarmouth just played a great match and we dug ourselves into too many holes.”