It did not take long for the wagons to circle around Gov. Andrew M. Cuomo, perhaps the best-known member of New York’s political establishment.

Within an hour of Alexandria Ocasio-Cortez’s stunning upset of a fellow Democratic stalwart, Representative Joseph Crowley of Queens, staffers for Mr. Cuomo were contacting reporters calling her victory an anomaly borne out of the minority-majority demographics in the district.

By morning, friends of Mr. Cuomo were calling Mr. Crowley’s campaign staff incompetent, while the New York City Council speaker, Corey Johnson, who recently endorsed Mr. Cuomo, sought to attribute Ms. Ocasio-Cortez’s victory in part to low turnout. Of the district’s active registered Democrats, only about 12.9 percent voted on Tuesday.

The reason for such spin was clear: Mr. Cuomo, 60, is facing a primary challenge of his own, from the actress Cynthia Nixon, who, like Ms. Ocasio-Cortez, is running for office for the first time. The two women had endorsed each other, and Ms. Nixon was reveling in her fellow upstart’s unexpected victory, calling it a win “for progressive Democrats over corporate Democrats.”