The new rules allow for a ban on travel “in and out of the affected areas” to limit the spread of the virus, according to an agreement adopted by federal and local authorities.
It comes as countries across the world are reimposing curbs on public life in response to a surge in new infections.
Germany, which has been less affected by the pandemic than many of its neighbours, aims to respond to new clusters with hyper-local lockdowns and rapid contact tracing and testing, rather than blanket lockdowns of whole
towns or districts.
The need for clear rules was highlighted last month when a Covid-19 outbreak at a slaughterhouse in the western state of North Rhine-Westphalia led to Germany's first renewed lockdowns, covering two neighbouring districts.
However a local court later ruled that the lockdown was too broad, and locals from the districts on holiday elsewhere in Germany complained about being turned away from their accommodation.
Chancellor Angela Merkel on Tuesday voiced support for travel bans in and out of coronavirus hotspots.
She said that it was “better for citizens” to have certainty rather than being denied entry to a hotel upon arrival.
Calling in the army
The text agreed on Thursday states that a travel ban should be imposed “if the numbers continue to rise and there's no certainty that the chain of infection has been broken” in the affected area.
Anyone wanting to leave a localised lockdown for another state must be able to show a negative coronavirus test that is less than 48 hours old, the agreement said.
Merkel's chief of staff Helge Braun told the ZDF broadcaster that the goal was to fight the virus with “faster, smaller and more precise” curbs rather than the larger lockdowns that have caused such economic devastation.
He said the military could even be called in to help ensure locals in an affected area get tested as quickly as possible.
Germany's Association of Towns and Municipalities (DStGB) welcomed the agreement, with CEO Gerd Landsberg calling local lockdowns “the right way forward”.
“This also means that lockdowns are not drawn out over months or weeks, but ideally last only a few days,” he told the Funke media group.
The new rules also come as Germany is anxiously eyeing the return of holidaymakers from abroad this summer, fearing they could be bringing the virus back with them.
Video footage of German tourists partying in Spain's Mallorca – without face masks or keeping the recommended 1.5 metres apart – has caused particular alarm.
Foreign Minister Heiko Maas warned Germans not to undo the progress made in combatting the virus.
“Such behaviour is not just dangerous, but inconsiderate towards all those who would like to enjoy their holiday safely,” he told the Funke group.
“We've only just managed to open borders in Europe again. We must not jeopardise this with reckless behaviour.”
Meanwhile, the Tönnies slaughterhouse that was the source of the local outbreak in North Rhine-Westphalia reopened on Thursday after four weeks, prompting a protest from Greenpeace activists against mass meat production.
Germany has recorded just over 200,000 coronavirus cases to date, and 9,078 deaths, according to the Robert Koch Institute for disease control.
The country has credited early, widespread testing and its world-class healthcare system for keeping the fatality rate relatively low.
Germans have also generally complied with rules on social distancing and wearing face masks.
More than 15 million people have also downloaded Germany's coronavirus warning app aimed at alerting people who've been in close proximity to an infected person.