Squatting in a residential building in England and Wales becomes a criminal offence on Saturday, meaning squatters would face jail or a fine.
Ministers said it would offer better protection for homeowners and "slam shut the door on squatters once and for all".
The maximum penalty will be six months in jail, a £5,000 fine, or both.
But campaigners warned the new law could criminalise vulnerable people and lead to an increase in rough sleeping.
Currently squatting is treated as a civil matter and homeowners - including councils and housing associations - have to go to a civil court to prove the squatters have trespassed before they can be evicted.
From 1 September it will be a criminal matter, and a homeowner can simply complain to the police who, if satisfied that the claim is genuine, can take action and arrest the squatters.
The law also protects owners of vacant residential properties such as landlords, local authorities and second-home owners.
The Ministry of Justice has issued guidance for police and other law enforcement agencies on the new offence.
Police must prove that a person knowingly entered a building as a trespasser and "is living or intends to live" in it.
Someone who falls behind with their rent or remains in a property at the end of a lease or tenancy would not be committing an offence under the new law.
But the law will apply to existing squatters to "stop trespassers rushing to occupy residential buildings before the offence comes into force".