Massachusetts residents will be automatically registered to vote when they make transactions at the state's Registry of Motor Vehicles or with MassHealth, under a new law signed by Gov. Charlie Baker.

The transactions include a change of address, for example.

Both the RMV and MassHealth, the Medicaid program funded by both the state and federal government, are able to verify whether people registering to vote are citizens, according to the office of Bill Galvin, the state's elections chief.

Applicants have to "specifically" decline to register as voters, otherwise their names and addresses are automatically added to the list of voters in the city or town that they live in, the office said.

"We will have systems in place to begin automatically registering voters at the Registry of Motor Vehicles and MassHealth on January 1, 2020, just in time for the next Presidential Primaries," Galvin said in a statement.

Voters who register through the RMV and MassHealth will be able to join a party or decline to register through their local elections officials.

Under the new voter registration law, Galvin can include other state agencies in automatically registering voters if those agencies can gather citizenship information to verify their status.

The new law was hailed by advocacy groups that had pushed for automatic voter legislation.

"Voting should be simple, accessible, and protected, especially in light of national efforts to limit access to the polls," Carol Rose, executive director of the ACLU of Massachusetts, said in a statement.

"With automatic voter registration, Beacon Hill has acted to engage nearly 700,000 more eligible Massachusetts voters in the democratic process," she added.

According to Common Cause Massachusetts, another advocacy group that backed the legislation, 13 states and the District of Columbia have passed similar bills.

"It is one of the strongest in the country and will make our voter registrations system more efficient, accurate, and secure while at the same time improving voter participation," Pam Wilmot, the head of Common Cause Massachusetts, said in her own statement.

The 13 other states are Alaska, California, Colorado, Connecticut, Georgia, Illinois, Maryland, New Jersey, Oregon, Rhode Island, Vermont, Washington, and West Virginia.