In an unprecedented public speech, John Sawers, the head of MI6, said that intelligence activities were responsible for Iran's admission last year of a second enrichment plant, which in turn led to tougher diplomatic pressure.
"Stopping nuclear proliferation cannot be addressed purely by conventional diplomacy. We need intelligence-led operations to make it more difficult for countries like Iran to develop nuclear weapons," he said.
Mr Sawers's comments come as six world powers seek to resume talks with Iran over its nuclear programme, which Tehran insists is for civilian purposes but which Western powers suspect is intended to develop atomic weapons.
The UN Security Council voted for fresh sanctions against Iran in June, the fourth set since December 2006 over its nuclear programme.
"The revelations around Iran's secret enrichment site at Qom were an intelligence success. They led to diplomatic pressure on Iran intensifying, with tougher UN and EU sanctions, which are beginning to bite," Mr Sawers said.
"The Iranian regime must think hard about where its best interests lie."
He added: "The risks of failure in this area are grim. And the longer international efforts delay Iran's acquisition of nuclear weapons technology, the more time we create for a political solution to be found."
Iran notified the UN nuclear watchdog in September last year that it was building a second enrichment plant near the central city of Qom, after Washington accused it of covertly evading its responsibilities under the Non-Proliferation Treaty.
Mr Sawers's speech was the first public address by a head of the Secret Intelligence Service (SIS), as MI6 is officially known, and marked his first year in the role.