The gun battle also razed an official building housing India's Income Tax Department in Srinagar, the summer capital of Indian-administered Kashmir.
Two of the separatists who had stormed the building were killed by security forces. The fighters had earlier killed a sentry guarding the building and a policeman.
During the gun battle, a fire broke out which quickly engulfed the building, trapping dozens of employees inside.
Local press photographers helped in the rescue operation after one employee trapped in the building waved her scarf from the window so people could identify and rescue her and others.
Police and paramilitary reinforcements joined in rescuing about 100 people from the blazing building, witnesses said.
In the evening, the officials declared that the gun battle was over after both fighters had been shot dead.
They also said they had retrieved a charred body, that of a head of the tax department, from the smouldering debris, and that the firefight had left half a dozen security men and an equal number of workers wounded.
However, people living in the neighbourhood said they heard occasional blasts and intermittent gunfire throughout the night.
On Saturday morning, the officials admitted that one of the holed up fighters was still aiming his assault rifle on the security forces who were "zeroing on him".
The gunbattle ended at 4pm (1030 GMT) when a spokesperson of India's main paramilitary Border Security Force announced that all armed fighters had been killed.
Also killed in the 24-hour gun battle were a deputy commandant of the BSF, C Rawat, and three security men and as well as the tax department worker.
Among more than a dozen injured persons were two security force officers, their four juniors and employees of the tax department.
Claim of responsibility
Al-Mansoorin, an obscure group, admitted carrying out the surprise attack and said that dozens of Indian soldiers had been killed or wounded.
Meanwhile, another firefight broke out in the Imam Sahib area of southern Pulwama district on Saturday, killing one Indian soldier and wounding another.
Officials said the fighting was still under way but Al-Mansoorin claimed that their members trapped in the village succeeded in coming out and have since relocated to their hideout.