The shot went up. The backboard lit up. The referee’s arm went up, then down, with an emphatic signal that K.C. Ndefo’s putback not only beat the clock (barely) but also beat South Side (barely) in a wild finish to a thrilling Nassau Class A championship game.

As the buzzer sounded, Ndefo banked home Ismael Astasie’s missed shot in the lane as No. 1 Elmont nipped No. 3 South Side, 58-56, on Saturday night at Hofstra to win the county title for the second year in a row.

“I was nervous, but Coach gave us a good play to run,” said Ndefo, who had 22 points, 14 rebounds and five blocked shots. “I knew it would work. I saw the shot go up and I hustled to get the rebound. I know it got out of my hands at the right time.”

While television replays were inconclusive — which is moot, anyway, given that replays cannot be used in New York except in the state championship game — the conclusion made for great theater.

Elmont (19-4) inbounded the ball near midcourt with 2.8 seconds left. Freshman guard Jevon Santos passed it to a cutting Astasie (13 points), who got off a runner in the lane that banged off iron to the right, where Ndefo was charging hard. He caught the ball and banked it home, all in one motion, to break the Cylones’ heart for the second straight year.

South Side, which lost to Elmont in double overtime in the 2016 title game, finished 17-6 and placed all five starters in double figures, led by Brandon Grayson and Ryan Prendergast with 12 apiece. Grayson had scored six consecutive points to put South Side ahead 56-52 with a minute left.

advertisement | advertise on newsday

Elmont played without starting point guard Victor Olawoye, who suffered an ankle injury in Wednesday’s semifinal. According to coach George Holub, he is expected to face Suffolk Class A champion Southampton for the Long Island championship next Sunday at 11 a.m. at Stony Brook. The winner will earn a trip to the state final four in Binghamton.

Astasie and Santos (nine points) capably filled the Olawoye void, but it was Ndefo who got the finishing run started by making two of three free throws. The Spartans retained possession when the missed foul shot bounced off a South Side player. That allowed Astasie to tie it at 56 with 18 seconds left on a floater in the paint — the same area where he missed just before Ndefo’s climactic shot.

“I thought he would dunk it,” Astasie said. There wasn’t time for that, but the finish was still spectacular. “It’s a play we run all the time. We call it ‘Five,’ ” Holub said of the play he drew up during a timeout after a charging call on South Side. “We knew they’d be all over K.C., so we wanted to get it to Izzy. He was supposed to go to the basket and K.C. was supposed to go to the rim and do what he does. K.C. put the team on his back today and just carried us.”

It was a nice wrap on the perfect birthday gift for Holub. “Happy birthday, Coach,” Ndefo said, hugging Holub.

“Never won a game on my birthday before,” Holub said. Then, referencing the Spartans’ semifinal victory over Hewlett, he pointed to his star and added, “We won on K.C.’s birthday Wednesday.”

Both have reason to keep celebrating.