Officials on both sides blamed each other for the exchange of fire.
Armenia said three police had been killed, while Azerbaijan said two of its soldiers "became martyrs."
Azerbaijan's Foreign Ministry said a shootout occurred when soldiers went to check vehicles suspected of transporting weapons. Armenia said the Azerbaijani armed forces opened fire on the car of a Passport and Visa Department of the police.
The two former Soviet nations have been locked in a conflict for decades over the mountainous region, which in 2020 boiled over into full-blown war.
Lachin Corridor a flashpoint
A Russian-brokered peace deal was reached late in 2020 after more than 6,000 lives were lost.
There have been several flare-ups between the two sides since the agreement was signed.
The agreement to end the 2020 war left a winding road called the Lachin Corridor as the only authorized connection between Nagorno- Karabakh and Armenia, a lifeline for supplies to the region's approximately 120,000 people.
However, traffic on that road has been mostly blocked since December by Azerbaijani environmental activists to protest what they say is illegal mining.
Armenia has accused Azerbaijan of backing the protesters to create blockade.
"Sending an international fact-finding team to the Lachin corridor and Nagorno-Karabakh is becoming a vital necessity," Armenia's foreign ministry said after the shooting.
Azerbaijan's ministry of defence said, "Today's incident once again shows that Azerbaijan needs to create an appropriate checkpoint on the Lachin-Khankendi road."
lo/jcg (AFP, AP)