The special operation yesterday was carried out by the State Security Service (SSS) and targeted four Azerbaijani citizens "suspected of planning serious crimes" motivated by "religious extremism," the security agency said in a statement.
They had "pledged allegiance to a terrorist organisation active abroad and were planning terrorist acts across the country," it said, without giving details.
"The group offered armed resistance using automatic rifles and guns," the statement added.
Security services in December killed a suspected Al-Qaeda-affiliated Islamist who planned to carry out a suicide bombing in the capital Baku's biggest shopping mall.
Local media had previously reported numerous cases of nationals from the officially secular ex-Soviet state fighting alongside IS jihadists in both the countries.