"Today, I proudly signed Rep. [Jedediah] Hinkle's law prohibiting federal overreach into our Second Amendment-protected rights, including any federal ban on firearms," Gianforte, a Republican, wrote on Twitter. "I will always protect our #2A right to keep and bear arms."
Republicans in the state passed the law amid President Biden’s push for federal gun reform measures in the wake of a series of mass shootings across the country this year.
Previous efforts to pass similar legislation in the last decade were thwarted by then-Democratic Gov. Steve Bullock.
The Montana law prohibits law enforcement officials and other state employees from enforcing federal restrictions or spending state funds on particular kinds of firearms, ammunition and magazines.
Arizona Gov. Doug Ducey signed a similar law earlier this month.
In Oklahoma, a bill that would designate that state as a Second Amendment "Sanctuary State" is headed for Gov. Kevin Stitt's desk.
Arkansas Gov. Asa Hutchinson vetoed a similar measure Friday, saying it would jeopardize law enforcement and the public.
Opponents of the Montana law have said it would make it more difficult for local law enforcement to collaborate with federal authorities on issues beyond gun access when such collaboration is essential to protect public safety, including in cases of domestic violence and drug offenses.
Gianforte has positioned himself as a champion of the Second Amendment. Earlier this year he signed a bill into law that allows concealed firearms to be carried in most places without a permit. It also expands where guns can be carried, including university campuses and the Statehouse.
The Associated Press contributed to this report.