After nearly 20 years of advocacy, Massachusetts is one step closer to authorizing driver’s licenses to undocumented immigrants.

With enough support to withstand a potential veto from the governor, the state Senate passed a bill Thursday that would allow residents without legal immigration status to apply for standard driver’s licenses. If enacted, applicants will be required to present proof of their identity, date of birth and Massachusetts residency.

The vote was 32 to 8, with five Democratic Senators — Nick Collins, Anne Gobi, Mark Pacheco, Walter Timilty and John Velis — voting against the party line.

A similar measure advanced from the House in February, also by a veto-proof margin. The two chambers must now reconcile the differences between their passed bills, which legislators describe as technical and few, before advancing it to Gov. Charlie Baker.

Baker has previously expressed his opposition to the bill, but he has not promised a veto if it reaches his desk. He reiterated concern Thursday that the bill would not effectively prevent ineligible people from unlawfully registering to vote.

Sen. Brendan Crighton, who sponsored the Senate version of the bill, celebrated the passage.

“The Work and Family Mobility Act will make our roads safer and, just as importantly, make the lives of more than 185,000 Massachusetts immigrants without status easier by allowing them to earn a standard drivers license,” Crighton’s statement said.

The bill’s passage through both chambers comes days after a new Suffolk University-Boston Globe poll showed Massachusetts residents divided on the issue, with about 47% of residents indicating they oppose such legislation and about 46% indicating their support. About 7% of respondents indicated they were undecided on the matter.

Critics, including Republican gubernatorial candidate Geoff Diehl, have said access to a driver's license should be reserved for those who immigrate to the United States lawfully and become citizens through its naturalization process.

Several senators Thursday attempted to amend the bill before its passage, proposing license language labels like “not eligible to vote” and “not valid for identification.” Most of the two dozen or so amendments were rejected or withdrawn from consideration.

If the measure is made law through either Baker’s signature or a legislative override of his veto, Massachusetts would join 16 states and the District of Columbia — including New England neighbors Connecticut and Vermont — in authorizing undocumented immigrants to get driver’s licenses, according to the National Conference of State Legislatures.