Ms. Nixon, a close ally of Mr. de Blasio who announced her campaign as negotiations on the budget heated up in mid-March, has made no secret of the fact that she intends to attack the governor on the state of the subways. (Her campaign website has a section devoted to #CuomosMTA.)

She has already called Mr. Cuomo’s liberal credentials into question. At her campaign’s debut, she asked if he was a “real Democrat,” and she has linked him to the Independent Democratic Conference, a group of eight breakaway Democrats in the State Senate who collaborate with Republicans. Several progressive groups in New York that have expressed their enthusiasm for Ms. Nixon’s candidacy have suggested that they will take their anger at President Trump out on the I.D.C. and its allies.

The budget seemed a perfect opportunity for Mr. Cuomo, who has spent most of the last 40 years involved in New York State politics, to show his mastery of Albany’s levers of power — and his knowledge of how to use them against his foes.

“Cuomo never, ever missed an opportunity to stick it to de Blasio,” said Douglas Muzzio, a professor of political science at Baruch College.

In the spending plan, Mr. Cuomo also sought and won new oversight of the city’s public schools. The budget requires districts located in cities with populations of more than one million to submit a detailed, school-by-school accounting of how they spent state educational funds. Previously, the state allocated money to districts but did not oversee the distribution of that money.

Like the city’s subways, if districts do not comply, the state can withhold funding.

Mr. Cuomo billed the move as a much-needed increase in transparency. But it also served a dual political purpose: It jabbed at the tradition of mayoral control of New York City’s schools, and it also allowed the governor to take an aggressive stand on the issue of educational equity — a marquee issue of Ms. Nixon, a longtime education activist who has placed the issue squarely at the heart of the early stages of her campaign.

Specifically, Ms. Nixon has blasted Mr. Cuomo for underfunding schools, accusing him of neglecting children of color in the poorest districts. But Mr. Cuomo on Friday said the issue was not the amount of money being spent, but rather how it was being spent.