Democratic voters in New York’s 14th Congressional District delivered a shock to the political system Tuesday night, rejecting the fourth-highest-ranking member of the party’s House leadership, Representative Joseph Crowley, in favor of Alexandria Ocasio-Cortez, a 28-year-old former Bernie Sanders campaign organizer who has called for abolishing the nation’s immigration and customs enforcement agency.

In doing so, voters delivered a message to Democrats and Republicans across the country, and perhaps in Albany: The liberal base is fired up, showing up at the polls, and may be ignored only at great political risk.

Ms. Ocasio-Cortez’s victory is a vivid sign of the changing of the guard. In addition to more liberal immigration laws, she ran on a platform calling for Medicare for all and a federal jobs guarantee. She also talked about the housing crisis in New York City, an issue that resonates deeply with many voters here. Her district, which runs through Queens and the Bronx, is majority-minority, but its leadership has yet to reflect those changes. That’s something Ms. Ocasio-Cortez was able to capitalize on fluently, casting herself as part of a new generation of young, unabashedly liberal Democrats unwilling to wait their turn any longer.

Many told Ms. Ocasio-Cortez she was crazy for challenging Mr. Crowley, a 10-term incumbent who had ambitions to succeed the House Democratic leader, Nancy Pelosi of California. As chairman of the Queens County Democratic Party, Mr. Crowley, 56, was a kingmaker in New York City politics. At his annual holiday party, city officials were expected to perform karaoke, singing and dancing on the stage to a song of Mr. Crowley’s choosing.

That power perhaps created a sense of hubris and complacency, the kind that no doubt contributed to Hillary Clinton’s loss to Donald Trump. In Mrs. Clinton’s case, it may have stopped her from campaigning harder in states like Wisconsin and Michigan, places where Mr. Trump eked out narrow victories. In Mr. Crowley’s case, it may have led him to become smug: The congressman had also skipped a debate with Ms. Ocasio-Cortez.

Ms. Ocasio-Cortez’s victory is also a reminder of the importance of improving healthy competition in Democratic primaries, where voters are too often taken for granted, especially in solidly blue states like New York, leading to lethargic turnout and weaker candidates. And many newly motivated women and other activists around the country are challenging Republican incumbents who others thought were unbeatable.

What remains to be seen, though, is whether Democratic leaders will embrace these newcomers or see them as a threat. That may determine whether Democrats are able to take back the House of Representatives in November.

Many voters are ready for something different. Politicians across the country should take note.

Correction:

An earlier version of this editorial referred incorrectly to the number of debates between Joseph Crowley and Alexandria Ocasio-Cortez. They faced each other more than just once.