BY A 33-4 VOTE, the Massachusetts Senate on Thursday afternoon passed legislation establishing protections for transgender people using public accommodations.

The bill (S 735) bans discrimination based on gender identity in public accommodations and would allow people to use bathrooms, locker rooms, and other sex-segregated facilities that correspond with their gender identity rather than physical anatomy.

“My heart breaks with gratitude. I can’t thank you enough,” Lorelei Erisis, a transgender woman from Ayer, told Senate Democrats at a press conference that immediately followed the vote. Erisis said she started transitioning in 2007.

“In Massachusetts we are civil rights pioneers by nature,” bill sponsor Sen. Sonia Chang-Diaz said during debate on the legislation.

The vote came nearly five years after enactment of a law aimed at guarding against discrimination against transgender individuals in housing and employment. The public accommodations language was dropped from that law prior to its signing by former Gov. Deval Patrick.

Arline Isaacson, co-chair of the Massachusetts Gay and Lesbian Political Caucus, said Thursday’s vote marked the first time that the public accommodations language had cleared either branch of the state Legislature.

“It was an amazing vote,” she said.

Republican Sens. Bruce Tarr, Ryan Fattman, Vinny deMacedo, and Donald Humason voted against the bill.

Humason, a Westfield Republican, said he didn’t want to see anyone “harmed in any way” but had to “look at protecting the privacy of constituents I represent.”

“Ultimately, I guess my concern was any time there is no set standard and it’s based simply on self-identification and that self-identification can change from one day to the next that becomes very difficult as a legislator to support and as a government to institute. It’s almost unenforceable, because it’s based simply on how someone feels on that particular day,” Humason said.

The House is expected to take up its own redrafted version of the bill (H 1577) this session.

Gov. Charlie Baker has declined to state his position on the bill, frustrating its supporters and forcing lawmakers to take into consideration the potential that he might veto the legislation. Most recently he has said “people should use the restroom facility they feel comfortable using.”

The Senate bill does not include language favored by House leaders that requires the attorney general to issue guidance and regulations for instances where people assert “gender identity for an improper purpose.”

“Governor Baker believes no one should be discriminated against based on gender identity and appreciates the added clarity that the House’s revisions provide into how the provision would be implemented across the commonwealth,” Baker communications director Tim Buckley said in a statement after Thursday’s Senate vote.

Andy Metzger and Matt Murphy contributed reporting to this story.