"We do not have nuclear weapons and we will not build them but in the face of aggression from the enemies, whether from America or the Zionist regime, to defend ourselves we will attack on the same level as the enemies attack us," Khamenei said live on television.
"Americans are making a grave mistake if they think by making threats they will destroy the Iranian nation," he said in his annual speech to mark Nowruz, the Iranian New Year.
Israel and the United States have threatened military action against Iran unless it abandons nuclear activities which the West suspects are intended to develop nuclear weapons.
Further talks between Iran and the P5+1 group of countries are expected to take place next month in an attempt to reach a compromise deal.
The most recent talks between world powers and Iran failed in January 2011 because of Iran's refusal to suspend its sensitive uranium enrichment work, as demanded by several U.N. resolutions and major powers.
It says it has the right to develop a peaceful nuclear program under the nuclear Non-Proliferation Treaty.
In his speech, Khamenei highlighted the country's nuclear achievements over the last 12 months - increasing uranium enrichment to 20 percent and loading domestically-made fuel rods into the Tehran Research Reactor.
"In a situation where the enemies were putting bets on the fall of the Iranian nation, and talking about the crippling sanctions, Iran has accomplished all these achievements," he added.
The U.S. and its allies have imposed tough new sanctions on Iran since this year which western diplomats say show signs of having a strong effect on the Iranian economy.
Earlier, Khamenei unveiled a national production plan and urged the nation to buy domestically-made goods, saying it would help to defeat sanctions.