Iran reached an agreement Sunday with the United Nations atomic agency that will grant international inspectors access to some of the country’s nuclear-related sites, a step likely to avert a crisis in the negotiations on restoring the 2015 nuclear deal.

The agreement comes after International Atomic Energy Agency Director-General Rafael Grossi made a last-minute trip to Tehran this weekend in a bid to persuade Iran to step up its cooperation with the agency ahead of a meeting of the IAEA’s top member states starting Monday.

The U.S., France, Britain and Germany had been discussing a formal censure motion against Iran next week if no agreement was reached, a step that Iran’s new President Ebrahim Raisi had said could scuttle the resumption of nuclear talks.

The nuclear talks started in April but were interrupted after Mr. Raisi was elected in June. The new government has refused so far to fix a date for resuming talks.I n a joint statement issued following talks between Mr. Grossi and the head of Iran’s atomic energy agency, Iran agreed to allow the agency access to a range of nuclear sites to reset equipment installed by the agency to monitor Iran’s activities.

The IAEA had warned that some of the equipment could soon stop functioning and Mr. Grossi has said that without it, the agency would be “flying blind” in ensuring that Iran wasn’t diverting nuclear material and equipment into a nuclear-weapons program.

“I think we managed to rectify the most urgent issue which was the imminent loss of knowledge that we were confronted with until yesterday,” Mr. Grossi told reporters on his return to Vienna on Sunday evening.