WASHINGTON — In May 2010, when the United Nations Security Council was weighing sanctions against Iran over its nuclear program, several members were undecided about how they would vote. The American ambassador to the United Nations, Susan E. Rice, asked the National Security Agency for help “so that she could develop a strategy,” a leaked agency document shows.

The N.S.A. swiftly went to work, developing the paperwork to obtain legal approval for spying on diplomats from four Security Council members — Bosnia, Gabon, Nigeria and Uganda — whose embassies and missions were not already under surveillance. The following month, 12 members of the 15-seat Security Council voted to approve new sanctions, with Lebanon abstaining and only Brazil and Turkey voting against.

Later that summer, Ms. Rice thanked the agency, saying its intelligence had helped her to know when diplomats from the other permanent representatives — China, England, France and Russia — “were telling the truth ... revealed their real position on sanctions ... gave us an upper hand in negotiations ... and provided information on various countries ‘red lines.’ ”

The two documents laying out that episode, both leaked by the former N.S.A. contractor Edward J. Snowden, are reproduced in a new book by Glenn Greenwald, “No Place to Hide: Edward Snowden, the N.S.A., and the U.S. Surveillance State.” The book is being published Tuesday.