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.
Housing Minister Grants Shapps said: "For too long, hardworking people have faced long legal battles to get their homes back from squatters, and repair bills reaching into the thousands when they finally leave. Ultimately the government needs to tackle why homeless people squat in the first place by helping not punishing them. No longer will there be so-called 'squatters rights'. Instead, from next week, we're tipping the scales of justice back in favour of the homeowner and making the law crystal clear: entering a property with the intention of squatting will be a criminal offence."
Homeowner Hugh Whittle told the BBC it was a "horrifying" experience when he returned from a stay in hospital to find squatters had moved into his residence in London.
"Just going through the three or four months it took to get them out was a cost in stress. And cost in money as well, of course, lost rent. And the property did actually become worse in its condition which meant that we had to pay builders more."
But the new law was criticised by some.
Catherine Brogan, from the campaign group Squatters' Action for Secure Housing, told the BBC: "What we need is to tackle the housing crisis and not criminalise some of the most vulnerable people in our society."
However, Justice Minister Crispin Blunt said homelessness was at the lowest level for 28 years and the government was spending £400m a year on homelessness and £164m on bringing about 10,000 empty homes back into use.
He told BBC Radio 4's Today programme: "This measure is about justice and fairness for homeowners who shouldn't have their homes stolen by squatters."
Leslie Morphy, chief executive of the homeless charity Crisis, said legal provisions were already in place for removing squatters from people's homes and the new offence could leave vulnerable people facing jail or a fine they cannot pay.
She said: "It will do nothing to address the underlying reasons why vulnerable people squat in the first place - their homelessness and a lack of affordable housing.
"Ultimately the government needs to tackle why homeless people squat in the first place by helping not punishing them."
Chief Constable Phil Gormley, the Association of Chief Police Officers' lead on uniformed operations, welcomed the move saying police could "now act immediately and remove squatters directly from properties".