KABUL, Afghanistan — A New York Times correspondent expelled this summer by the government of Afghanistan will be allowed to return to the country effective immediately, according to an order issued on Sunday by the Afghan attorney general’s office.

The decision to lift the order against the reporter, Matthew Rosenberg, came days after the inauguration of Ashraf Ghani as the new president. Mr. Ghani had publicly promised to reverse the action taken by the government of his predecessor, Hamid Karzai.

Mr. Ghani called Joseph Kahn, The Times’s assistant editor for international, early Sunday and said that Mr. Rosenberg would be welcome back in Afghanistan, as would any other reporters The Times wanted to send.

The decision was welcomed by Dean Baquet, executive editor of The Times, who said: “We are appreciative that the new administration understands the value of the press and that Matt is an honest and independent journalist. We thank President Ghani for his action.”