Police said they had acted on a tip-off that a small group of fighters were holed up in the building.
"Two terrorists have been killed, one was arrested and two more escaped. Two officers have also received gunshot injuries," Karnail Singh, the police commissioner, said.
Soon after the shooting broke out, scores of police officers, many in riot gear, fanned out through Jamia Nagar.
India's NDTV television news station reported at least two policemen were wounded in the fighting.
Singh said there were five armed men involved in the firefight.
One of the dead fighters was identified as Atiq, a man wanted in connection with serial bombings in the western city Ahmedabad on July 26, Singh said.
New Delhi was hit by serial blasts in busy shopping areas last week which left 22 people dead and around 100 wounded.
The attacks were claimed by a group calling itself the Indian Mujahidin.
The clash came a day after the government unveiled new security measures designed to tackle what Manmohan Singh, the Indian prime minister, said were "vast gaps" in intelligence gathering on armed groups.
The cabinet approved proposals to hire 7,000 additional policemen in New Delhi, install closed-circuit television cameras in busy areas and create a research wing in its intelligence agency.
India has routinely blamed Pakistan or Bangladesh-based groups for dozens of attacks in the last three years.
But as the death toll has mounted this year, evidence has pointed to the involvement of groups based in India, raising questions for the government about growing anger among India's large Muslim minority.