The incident took place in the Yardymli district on Azerbaijan's southern border with Iran where a group of eight to 10 people were seen trying to cross into Iran, a statement from the border guard service said.
"The border violators ignored warning shots and opened fire. Five of them were killed in a shootout and two were detained," it said.
"The group consisted of Bangladeshi nationals and their Azerbaijani guides who were armed," it added, without giving further details.
The Caucasus nation of 9.4 million is a transit country for illicit narcotics by virtue of its location along major drug trafficking routes from Afghanistan and Iran to Europe and Russia, the US Department of State said in its 2016 International Narcotics Control Strategy Report.