Chancellor Angela Merkel's coalition government has agreed to require migrants granted residence rights to show willingness to integrate by learning German and seeking work or else have their benefits cut.
Ending months of disagreement, Merkel's Christian Democrats, their conservative Bavarian CSU allies and the Social Democrats hammered out a deal on Thursday for post-war Germany's first law on integrating immigrants.
They also worked out new counter-terrorism measures and agreed to relax rules giving European Union citizens priority in employment so migrants can enter the job market more easily.
The deal capped months of disagreement about how to handle over a million migrants and refugees who poured into Germany last year.
Those fleeing war in Syria and Iraq have the best chances of staying, while economic migrants may be sent home.
Merkel said the agreement, to be approved by her cabinet on May 24, contained "an offer for everyone, but also duties for everyone".
Along with language learning, it says that migrants who break off job training courses will also lose benefits.
The chancellor said Germany faced two challenges with Europe's migrant crisis.
The first was to co-ordinate the influx of refugees with European partners and progress had been made on that, she said.
"The other challenge is to register and achieve the integration of the large number of people who have arrived here," she told reporters.
"We will have a German national law on integration - this is the first time in post-war Germany that this has happened, it is an important, qualitative step."