The Senate, controlled by Republicans and a small group of Democrats, failed to pass the measure despite a vote of 30 in favor and 29 opposed. It required 32 votes in favor to pass.
Even advocates were surprised: Latino activists who had planned to visit the Capitol on Tuesday to lobby for the measure said they would now use the trip to express their frustration.
All of the Republicans present voted against the measure; two Democrats, Simcha Felder of Brooklyn and Ted O’Brien of the Rochester area, also voted no.
The vote on Monday came after a tense debate that stretched for more than an hour and was filled with emotional pleas for support from many Latino and black senators. “This is an opportunity — an opportunity to do the right thing,” said Senator José R. Peralta, Democrat of Queens.
The legislation would have allowed undocumented students who met certain conditions to receive financial aid through state programs, like the Tuition Assistance Program. It would also have created a private scholarship fund for the children of immigrants, and allowed undocumented students and their families to open college savings accounts.
The Democratic-controlled State Assembly passed the measure last month. Gov. Andrew M. Cuomo, a Democrat, had not been a vocal advocate for its passage, which irritated a number of Hispanic lawmakers, but he had been expected to sign it if the Senate passed it. But it had been unclear for months if the bill had the necessary Senate support.
The measure, known as the Dream Act, got its name from federal legislation that would provide a path to citizenship for young immigrants who entered the country illegally. The New York measure would not offer an opportunity to gain legal status.
More than a dozen states offer in-state tuition rates to illegal immigrants. New York has done so for more than a decade, and an estimated 8,300 undocumented immigrants were attending public institutions of higher education in the state in the fall of 2013.
But only four states — California, New Mexico, Texas and Washington —offer state financial aid to undocumented students, according to the National Conference of State Legislatures.