Zohran Mamdani, 34, is the projected winner of New York City's race for mayor in a contest that rallied young voters and sparked debate about the future direction of the Democratic Party.

The Ugandan-born Mamdani, a Democrat, beat former New York Governor Andrew Cuomo, running as an independent, to become the youngest person in over a century to lead the largest city in the US.

A self-described democratic socialist, he made affordability the central message of his campaign, pledging to expand social programmes paid for by new taxes on high earners and corporations.

Mamdani was a relatively unknown member of New York State Assembly until his campaign gained online momentum a few months ago, propelling him to victory in the Democratic primary contest over the summer.

His campaign has drawn significant national attention, including from US President Donald Trump, who in the days before the vote threatened to withhold federal funds from New York if Mamdani, whom he called a communist, won.