Amir Moss completed a three-point play with 1.7 seconds remaining Friday night, giving top-ranked Portland a 59-57 victory against fifth-seeded Deering in a Western Class A boys’ basketball semifinal at the Cross Insurance Arena.

Moss was fouled while scoring a go-ahead basket, and after a timeout he added a free throw to complete the play. Deering then tried a long pass that was intercepted by Moss as time expired.

Portland (18-2) will play third-seeded Falmouth (17-3) for the Western Maine title Saturday night at the CIA.

Deering held a 57-56 lead when Portland inbounded the ball with 24.3 seconds remaining, setting up the ending.

Steve Alex, the leading scorer for the Bulldogs, brought the ball down the court and passed to Liam Densmore, who skipped a pass to Moss near the sideline in front of Portland’s bench.

Moss drove the paint and laid up a baby hook shot for the winner while being fouled.

“The play was meant for (Alex), but it got broken down and we had to operate any way we could,” said Moss.

“The ball wound up in my hands. I took the shot I practice. I didn’t want to go home so I had to put it in the basket. That’s what I did. It felt great. Once it left my hand, I had a feeling it was going in. It felt unbelievable. It’s a great feeling.”

The entire game was an uphill struggle for the Bulldogs, who are seeking a second straight state championship. Alex was in foul trouble almost from the start and played sparingly.

The Bulldogs trailed the entire second quarter as Deering (13-7) carried play. Alex picked up his third foul on a technical with 6:25 remaining in the second quarter and sat out the rest of the half. He got his fourth foul with 4:57 left in the third and didn’t return until three minutes remained in the game.

Deering led 33-28 at halftime, but Portland scored the first nine points of the third quarter to take a 37-33 lead, including back-to-back 3-pointers by Joe Esposito and Densmore.

Moses Oreste scored for the Rams to make it 37-35, but Moss hit a 3 – the Bulldogs’ third straight. Portland outscored Deering 20-9 in the third quarter to open a 48-42 lead.

The game stayed tight the rest of the way, with the final 1:30 particularly hectic. Trailing 56-52, Deering scored five straight points to take a one-point lead. Oreste and Max Chabot scored to tie it after two straight Portland turnovers. A third turnover resulted in Oreste going to the line. He made 1 of 2 free throws to put Deering up by a point with 24.3 seconds left.

With Alex on the bench for most of the game, the Bulldogs got step-up performances from several reserves, including Charlie Lyall, Terion Moss and Manny Yugu.

But the constants were Moss, Densmore and Esposito.

Densmore led the Bulldogs with 17 points, Moss had 15, and Esposito, after getting off to a quick start, finished with 10.

Oreste, a reserve, led Deering with 14 points. Ben Williams had 13 and Garang Majok 11.

The game followed the pattern of the first regular-season meeting between the two rivals. Deering led for most of the game, only to lose it at the end.

Portland blew out Deering in the final regular-season game.