The legislation was approved by 188 out of 205 deputies, who attended Sunday's parliamentary session, broadcast live on state-run Tehran radio.
"The government of the Islamic Republic of Iran is required to pursue, within the framework of the Nuclear Non-proliferation Treaty ... to enable the country to make peaceful use of nuclear energy, including the cycle of nuclear fuel," the legislation said.
The bill does not force the government to immediately resume uranium enrichment, but it brings greater pressure on it not to give up its controversial nuclear programme, including uranium enrichment.
The legislation comes at a delicate time, with Iran announcing that it is planning to resume uranium-reprocessing activities and the European Union threatening to take Iran to the UN Security Council for possible sanctions if it does.
Foreign Ministry spokesman Hamid Reza Asefi said on Sunday Iran had decided to give negotiations with the Europeans a last chance before it resumed uranium reprocessing activities at Isfahan Uranium Conversion Facility in central Iran.
Asefi said Iran had postponed the resumption of uranium reprocessing at the request of many governments around the world, including European Union member states, to give dialogue a last chance to succeed.
He, however, said Tehran would eventually resume nuclear work with or without agreement with the Europeans.
Iran and the Europeans, according to the spokesman, were considering convening a meeting of the foreign ministers of Britain, France and Germany and Iran's top nuclear negotiator, Hasan Rowhani, to try to defuse the looming crisis.