Sypniewski, a City Court judge and former county prosecutor, will succeed Karen Drago, who will retire at year-end.

The recount of the Nov. 4 race began on Nov. 12, with Sypniewski leading Litz by 394 votes.

Outside the county Elections Board office, Sypniewski thanked his supporters, said he was humbled by his victory and commended Litz on his campaign.

"We're glad in the end that we maintained our lead and I'm extremely honored knowing I'll be the next county court judge," added Sypniewski, 38. He'll earn $152,500 a year when he takes the bench in January.

Republican lawyer Mike Cuevas said Litz is out of town, but had told Cuevas in a phone conversation that he was thrilled by the county-wide support his campaign received.

"When you have over 42,000 votes cast, the margin here shows the voters thought there were two very qualified candidates; one had to win, the other, not," said Cuevas.

Litz said, in a statement, "A special thanks to my family who were by my side every step of the way and to all of the voters of Schenectady County. I congratulate Matt and wish him all the best."

By the time counting ended early Thursday afternoon, Sypniewski held an insurmountable 223-vote lead with 136 affidavit and contested absentee ballots to be counted. The result must still be certified.

Sypniewski, who has presided over cases in City Court since 2011, lives in Schenectady, where he was born and raised. After graduating from Albany Law School and working on Wall Street, Sypniewski returned home to become a county prosecutor. He became chief of the major crimes bureau in District Attorney Robert M. Carney's office.