Greg Abbott took the unusual step of signing the legislation – which threatens sheriffs with arrest if they refuse to cooperate with federal authorities – during a live Facebook video broadcast.
“Citizens expect law enforcement officers to enforce the law, and citizens deserve law breakers to face legal consequences,” he said before signing the law.
“Texans expect us to keep them safe, and that is exactly what we are going to do.”
The law prohibits cities from declaring themselves “sanctuary cities” – an unofficial designation – requiring local officials to carry out federal requests to hold criminal suspects for possible deportation.
The bill prompted protests in Texas, including a sit-in in Abbott’s office.
The police chiefs of Houston and Dallas – the state’s two largest cities – last week called the measure a “burden” on local law enforcement agencies.
Other critics say the new law may be used to discriminate against Latinos and other minorities.
“Gov. Abbott just gave Texas police a license to discriminate,” the American Civil Liberties Union tweeted.
President Donald Trump has blasted the sanctuary cities movement opposing his hard-line immigration policies.
His attorney general, Jeff Sessions, has accused them of allowing illegal immigrants who are violent criminals to go free.
Trump has promised to expel a large part of the more than 11 million undocumented immigrants in the country.
However, last month a court blocked his executive order to deny cities harboring undocumented immigrants billions of dollars in federal funding.
More than 300 cities and counties have denounced the order.
Watch: Australians learn how to give sanctuary to asylum seekers 0:00 Share