Tehran on Tuesday invoked its "sovereignty" to dismiss Azerbaijan's concerns over Iranian military exercises near their shared border.
"The drills carried out by our country in the north-west border areas ... are a question of sovereignty," Iranian Foreign Ministry spokesman Saeed Khatibzadeh said.
Tehran "will take all measures it judges necessary for its national security", Mr Khatibzadeh said.
"Iran will not tolerate the presence of the Zionist regime near our borders."
He was referring to Azerbaijan's relations with Iran's enemy, Israel.
Azerbaijani President Ilham Aliyev had criticised Tehran over the drills, calling them "a very surprising event".
"Every country can carry out any military drill on its own territory," he told Turkish news agency Anadolu. "It's their sovereign right. But why now, and why on our border?"
No further details were available on the military exercises.
Fighting broke out between Azerbaijan and Armenia in September last year over the disputed Nagorno-Karabakh region, claiming about 6,000 lives over six weeks.
Israel, a major supplier of arms to Azerbaijan, came under diplomatic fire from Armenia over the struggle between the Caucasus neighbours.
Iran and Azerbaijan share a border of about 700 kilometres and normally enjoy good relations.
There are an estimated 10 million members in Iran's Azeri-speaking community.