German Chancellor Angela Merkel has reached a deal on immigration to end a row that threatened to break up her four-month-old coalition government.
Interior Minister Horst Seehofer has now dropped his threat to resign after hours of talks.
Mrs Merkel agreed to tighten controls at the Austrian border to stop people who have applied for asylum in other EU countries from entering Germany.
Transit centres will be set up to hold them until they can be sent back.
Mrs Merkel described the deal as a good compromise after tough negotiation.
However, questions are already being asked about how it will work on the border with Austria. The government in Vienna said on Tuesday it would prepare measures to protect its southern borders and seek a quick clarification of the German decision.
Mr Seehofer leads the Christian Social Union (CSU), the Bavarian sister party of Mrs Merkel’s Christian Democrats (CDU).
“After intensive discussions between the CDU and CSU, we have reached an agreement on how we can in future prevent illegal immigration on the border between Germany and Austria,” he told reporters as he was leaving the CDU’s Berlin headquarters.
The BBC’s Jenny Hill in Berlin says Mr Seehofer may have overplayed his hand by issuing his ultimatum, only for Mrs Merkel to return from Brussels on Friday with an EU-wide strategy and bilateral agreements with more than 10 countries.