The accord will end decades of economic sanctions against Iran in exchange for restrictions on its nuclear program.