Security forces called to Radio Television Afghanistan in the city of Jalalabad were drawn into a long gun battle with the attackers.
Four employees of the TV station and two police officers were killed, Nangarhar province governor's spokesman Atauolah Khogyani said.
ISIS claimed the attack in a message posted on the Telegram messaging service by the ISIS-affiliated media Amaq. CNN cannot independently verify the authenticity of the claim.
At least 19 people were injured in the attack, including seven who were treated in hospital and released, the provincial health services director, Najibullah Kamawal, said.
An explosion erupted from the area of the assault after the attackers entered the building, police said. Footage from the scene showed people running in panic as a barrage of gunfire rang out.
A crisis response team was called to the scene and searched the premises room by room.
Civilians are often targeted by militants in Afghanistan in bombings and shooting attacks.
In February, a team of three drivers and five Red Cross field officers was on its way to deliver livestock materials to an area in Jawzjan province when "unknown armed men" attacked it
, the International Committee of the Red Cross said.
A month before that, dozens were killed in a flurry of attacks
across the country, including twin suicide bombings near the Afghan Parliament in Kabul, an explosion at a Kandahar province government compound, and a suicide bombing in Helmand province.
In August 2016, an attack
led to the deaths of 13 people including students and staff at Kabul's American University of Afghanistan.
In all, 3,498 civilians were killed and 7,920 injured in 2016 in Afghanistan, the UN Assistance Mission in the country reported. It marked the highest number of civilian casualties since the UN began documenting statistics in Afghanistan.