A Japanese diplomat who favors a firm approach toward Iran was elected to lead the International Atomic Energy Agency on Thursday, narrowly edging out a South African for the post.

In the last of six rounds of voting at the organization’s headquarters in Vienna on Thursday, the Japanese diplomat, Yukiya Amano, won the required two-thirds majority of the 35-nation board, with 23 votes in favor and one abstention, said an agency official who spoke on the condition of anonymity because the election results will not be official until the governing board formally accepts them on Friday.

In earlier rounds of voting, Mr. Amano had been locked in a tie with a South African diplomat, Abdul Samad Minty.

Mr. Amano, 62, will become the fifth director general of the agency, an organization affiliated with the United Nations that monitors and investigates charges of illicit nuclear proliferation and promotes atomic energy for peaceful purposes. He will replace Mohamed ElBaradei, whose term expires in November.