The confrontation follows months of tensions over the blockage of the only road connecting Armenia with Nagorno-Karabakh, an ethnic Armenian enclave in Azerbaijan.
Armenia's Defense Ministry said Azerbaijan fired on soldiers who were performing unspecified engineering work near the Armenian village of Tegh, about 3 kilometers (2 miles) from the border. Four Armenian soldiers were killed and six wounded, it said.
Azerbaijan said it was Armenian soldiers who opened fire, and that three Azeri soldiers died.
The clash area lies along the Lachin Corridor, the road that leads to Nagorno-Karabakh.
That region came under control of ethnic Armenian forces backed by Armenia in 1994 after a separatist war in which Armenia also took control of adjacent territories.
During six weeks of intensive fighting in 2020 that ended with a Russia-brokered truce, Azerbaijan took control of the territories and of part of Nagorno-Karabakh itself. Russia sent in a peacekeeping force that was tasked with maintaining order and protecting the Lachin Corridor.
But in December, demonstrators who claimed to be environmental activists began blocking the road, alleging that Armenia was conducting illegal mining in the region.
Armenia contends the protests are orchestrated by Azerbaijan. In turn, Azerbaijan alleges that Armenians have used the corridor to transport land mines into Nagorno-Karabakh in violation of the armistice terms.
The road blockage has led to food shortages in Nagorno-Karabakh. Azerbaijan also has periodically cut gas and electricity supplies.
Short link: