But Ms. Ocasio-Cortez was not the only liberal insurgent — or the only young candidate of color — to rattle the entrenched Democrats in the city. In Brooklyn, Adem Bunkeddeko nearly unseated Representative Yvette Clarke, a veteran incumbent from a local dynasty; he lost by barely 1,000 votes. And Representative Carolyn Maloney drew less than three-fifths of the vote against another first-time candidate, Suraj Patel.

Establishment-backed Democrats fared better elsewhere, including a contentious House primary in Colorado. But the unrest in New York City is a landmark moment: For all its cultural liberalism, the city is usually a politically rigid place — a tough arena for newcomers, given the party machines and election laws that discourage competition. On Tuesday night, the ossified Democratic institutions got a new kind of scare.

And one of the very methods New York’s Democratic establishment uses to maintain its grip — separating federal and state primaries to better control the electorate — could now come back to haunt them. Ms. Ocasio-Cortez’s triumph will deliver an injection of money and energy into Cynthia Nixon’s challenge to Gov. Andrew Cuomo, offering her the sort of momentum going into the September primary that she might not have had were it not for the state’s bifurcated nominating process.