Just after 4 p.m. Monday, Gov. Charlie Baker put pen to paper and enshrined in law the notion that men and women performing the same work should be paid equally.

After faltering on Beacon Hill in previous sessions, gender pay equity got a vigorous push this session from lawmakers, business organizations and advocates. Baker identified it as one of six major bills he hoped the Legislature would pass so he could sign it.

"Our daughters and granddaughters, and our sons and grandsons, will face a fairer work environment than we have," Sen. Patricia Jehlen, who sponsored the bill with Reps. Ellen Story and Jay Livingstone, said. "This will help reduce income inequality. Fewer women will raise their children in poverty and those children will have a better chance to succeed in life and succeed in school."

She added, "Today in Massachusetts we say, equal pay for equal work is not just a slogan, it's the law."

Baker signed the bill with Lt. Gov. Karyn Polito, cabinet secretaries Marylou Sudders and Kristen Lepore, Treasurer Deborah Goldberg, Auditor Suzanne Bump, former Lt. Gov. Evelyn Murphy, about two dozen lawmakers, Senate President Stan Rosenberg, and House Speaker Robert DeLeo by his side.

"This is a Commonwealth of Mass. that in 1954 passed the first legislation around gender discrimination and I think it's incredibly apt that we would be one of the first states in the country here today to pass legislation to ensure that people are paid what they are worth, based only on what they are worth," Baker said.

The bill (S 2119) prohibits discrimination on the basis of gender in the payment of wages for comparable work "unless the variation is based upon a mitigating factor" including seniority, education, training, experience, or a bona fide merit system like one that measures earnings by sales.

The compromise contains a Senate-backed provision that forbids businesses from requiring a job applicant disclose their previous salary history, though the employer may inquire about previous salaries after making a job and compensation offer to the prospective employee.

It also encourages businesses to evaluate their own pay practices and would allow self-evaluations to be used as an affirmative defense in a pay discrimination claim, if they were conducted within the previous three years and the employer could demonstrate "reasonable progress" toward closing pay differentials. The evaluation and any steps taken to close a gap could not be used as evidence of a violation of pay equity.

"It makes our families stronger, our state stronger and our economies thrive," Goldberg said. "Wage equality is not just a women's issue, it is a family issue. It is good for the economic security for each and every family in Massachusetts and the economic stability of the commonwealth."

DeLeo said the pay equity bill "gets to the heart of who we are as Americans."

Rosenberg counted it alongside an increase in the Earned Income Tax Credit as part of a Senate platform to help low- and middle-class families. He made a not-so-subtle pitch for the third piece of that platform: a paid family and medical leave bill the Senate passed on Saturday, on the eve of the end of formal sessions for the year.

Story, an Amherst Democrat who is retiring after more than 24 years in the House, said she first filed a gender pay equity bill in 1995.

"This is a good day," she said. "Better late than never."

The legislation most closely resembles the version approved unanimously by the House, which business organizations like Associated Industries of Massachusetts, the Alliance for Business Leadership and the Massachusetts Business Roundtable had supported.

The bill cleared the Legislature with unanimous support, the House enacted the bill 151-0 and the Senate did so 40-0.

A study from the Institute for Women's Policy Research reported earlier this year that the state's earnings ratio placed Massachusetts in 18th place nationally for pay equity and, without changes, the state's wage gap was expected to persist until 2058.

Rep. Patricia Haddad, whom DeLeo credited with pushing the bill over the finish line this session, charged everyone present for the bill signing to make equal pay for equal work a central tenant of what they teach their children.

"To change the culture, we have to bring up our sons to remind them that there is no difference, that they should revere and push forward their sisters, their wives, of course their mothers, and be the culture change," she said. "We've committed to it, now you have to go out and raise your sons and daughters to know that there is no difference, that equal means equal."