(CNN) -- Hawaii Gov. Neil Abercrombie signed into law a bill that will legalize civil unions for same-sex couples in the Aloha State.

"People have worked long and hard for this day," Abercrombie said at the bill-signing ceremony Wednesday. "This is a prime example of exercising civic courage. It is about doing what is right, no matter how difficult, no matter how much opposition."

The law goes into effect on January 1. It extends the same rights and benefits to partners in a civil union that spouses in a marriage enjoy.

In July, former Hawaii Gov. Linda Lingle vetoed a similar bill, saying the issue needed to be put to a referendum. Gay rights groups decried her decision.

Five states and the District of Columbia issue marriage licenses to same-sex couples, according to the National Conference of State Legislatures. Hawaii joins New Jersey in allowing civil unions.

Three states -- Rhode Island, New York and Maryland -- recognize same-sex marriages from other states, according to the conference.

California recognizes same-sex marriages performed during six months in 2008 after its Supreme Court granted same-sex couples the right to marry and before the passage of Proposition 8, which overturned the court's decision.