The democratic socialist vanquished Andrew Cuomo in a contest being closely watched by national Democrats, Republicans and the White House.