There was no immediate announcement from the militant group, which has claimed responsibility for a series of assaults in Tajikistan in recent months.
Five of the gunmen were captured after the attack on the Tajik side of the border, 50 km (30 miles) southwest of the capital Dushanbe, Tajikistan's National Security Committee said.
It released a photograph showing the badly burned bodies of three men in black military-style outfits, lying on the ground next to a wrecked car.
The committee said the gunmen had entered the former Soviet republic earlier this month via its border with Afghanistan.Islamic State claimed responsibility for an attack on Western cyclists in Tajikistan last year and for a prison riot in May.