Despite a rollercoaster campaign, 27-year-old Democratic Socialist Julia Salazar's run for New York’s state senate demonstrated that women aren’t just running for office in unprecedented numbers this year – they’re winning. In New York’s primaries on 13 September she defeated the 68-year-old state senator Martin Dilan, who has represented the 18th district in North Brooklyn since 2002. There is no Republican running against her, so she is virtually guaranteed her seat. She will be the first socialist in New York’s senate in almost a century.

Salazar’s campaign was boosted by the shock victory in June of Alexandra Ocasio-Cortez, the 27-year-old activist who defeated the 57-year-old Democratic giant Joe Crowley after successfully attacking him from the left. Ocasio-Cortez also describes herself as a Democratic Socialist and the pair share a similar agenda: both are calling for the abolition of ICE and comprehensive immigration and criminal justice reform, the expansion of Medicare for all, free university tuition, more rent-controlled housing and other pro-poor policies.

“Tonight’s victory is not about me,” Salazar tweeted shortly after the result was announced. “Tonight’s victory is about New Yorkers coming together and choosing to fight against rising rents and homelessness in our communities. Together, we will build a better New York.”

Salazar won by around 57 per cent of the vote, despite a shambolic and scandal-ridden campaign in which she was accused of lying about being a working-class Jewish immigrant and of formerly being a Republican with anti-abortion views. (The Cut has a good summary of these controversies.) A bizarre lawsuit was dug up in which Salazar was arrested but never charged for committing bank fraud by impersonating the wife of the New York Mets baseball legend Keith Hernandez. Salazar later sued Hernandez’s wife for defamation. In another instance, which feels instructive of the kind of pressures faced by female candidates, she was forced to pre-empt an article by the right-wing website the Daily Caller that threatened to expose her as a survivor of sexual assault.

In the state senate primaries, six Democrats who had collaborated with Republicans for control of the chamber lost their elections, demonstrating that New Yorkers have little tolerance for elected officials partnering with Trump’s party.

But the promised “blue wave” of progressive candidates did not crash to victory. New York’s governor Andrew Cuomo comfortably defeated a challenge from the left by the Sex and the City star Cynthia Nixon, an education and LGBT rights activist. Cuomo won by 30 per cent, in a result that was called just half an hour after the polls closed and that marked a disappointing end to Nixon’s spirited and nimble campaigning.

In the attorney general race, too, the Fordham Law School professor Zephyr Teachout finished second to Leticia James, a New York public advocate who was backed by Cuomo. If James wins in November she will be the first black woman to hold state-wide office in New York.

It’s the third time that Teachout has run for office in New York and lost. The activist and anti-corruption expert first ran for governor against Cuomo in 2014 and defied all predictions to capture more than 30 per cent of the vote, forcing the governor to tack left. She sustained a remarkable energy on the campaign trail despite being heavily pregnant, with her baby due in October.

While New York progressives are likely disappointed this morning, the primaries have nevertheless shifted the political conversation leftwards in the state. And they offer a measure of the changing face of American politics as more women, people of colour and other candidates with unconventional backgrounds are inspired, often by the horrors of the Trump administration, to run office.