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

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.

My friends, we have toppled a political dynasty, the self-described democratic socialist told the crowd during a victory speech.

Democrats also won governor races in Virginia and New Jersey, while in California voters backed a proposition to redraw the congressional electoral map ahead of next year's midterm elections.

Mamdani made affordability the central message of his campaign, pledging to expand social programmes paid for by new taxes on high earners and corporations.

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

Mamdani has become the first South Asian and Muslim to lead the city. In his victory speech, he spoke of a new age.

For as long as we can remember, the working people of New York have been told by the wealthy and the well-connected that power does not belong in their hands, Mamdani said.

The future is in our hands, he said, pledging to create a government that works for everyone.

Mamdani's 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 won.

The president calls Mamdani a communist - a label that Mamdani rejects.

In overnight projections from CBS, Mamdani had secured 50.3% of the vote, compared with Cuomo's 41.6%. Republican Curtis Sliwa had just over 7%. Shortly after the winner was projected, Sliwa conceded.

Cuomo also conceded, congratulating Mamdani despite a chorus of boos from his supporters, emphasizing that almost half of New Yorkers who voted had not picked Mamdani.

Critics have raised concerns over how Mamdani will finance his ambitious social agenda and questioned the executive experience of a politician who has never held such a significant role before.

Republican Speaker of the House Mike Johnson criticized the consequences of New York City's choice via social media, indicating that Mamdani's election cements the Democratic Party's shift towards a more radical socialist agenda.

With a victory that underscores a generational shift, the question remains whether the national Democratic Party will embrace this new direction or push back against its more progressive wing.