The assault, claimed by the Islamic State group, lasted about three hours before Afghan special forces overpowered the attackers armed with guns and grenades and freed staff trapped inside the building.
"The attack has ended. According to the commander of the special forces all the staff who were inside the building have been rescued," Shamshad TV announced as it went back on the air in an act of defiance just moments later.
"This is an attack on freedom of media but they cannot silence us," Shamshad news director Abid Ehsas told rival Tolo News at a hospital in the Afghan capital where some of his wounded colleagues are being treated.
The station reported that one attacker blew himself up at the gate. Another attacker went inside and shot at staff before going up to the roof to fire on security forces.
Special forces troops had blasted their way through a wall of the compound to enter the premises of the Pashto-language broadcaster.
"I was in my office when gunmen wearing police uniforms attacked the building," Ehsas said.
"They killed one of our guards and entered the building and started firing. Most of us were able to flee but some were wounded and some jumped out of the windows."
He said the station had not received any threats before the attack.
Gunshots could be heard inside the building every few minutes during the assault as more and more security forces and emergency services swarmed the area.
At least one employee told AFP he had seen three attackers entering the building on security cameras.
"They first shot the guard and then entered the building. They started throwing grenades and firing," Shamshad TV reporter Faisal Zaland, who escaped through a back door, told AFP.
Interior ministry spokesman Najib Danish said two guards had been killed and five people wounded -- a Shamshad employee and four firefighters.
Taliban not involved
Islamic State claimed responsibility for the attack in a statement released by their Amaq propaganda agency. The Taliban had earlier released a Twitter statement denying involvement.
Pashto is one of the official languages in Afghanistan and is spoken mainly in the south where the Taliban have a large presence.
Kabul has been rocked by a series of deadly attacks in recent weeks as the Taliban and Islamic State step up offensives against security installations and mosques.
The attack spotlighted the dangers faced by media workers in Afghanistan as security worsens. Violence against Afghan journalists surged in the first half of 2017, a media watchdog said in July.
Last year the country suffered its deadliest year on record for journalists, according to the Afghan Journalists Safety Committee, with at least 13 media workers killed -- 10 by the Taliban. That made it the second most dangerous place for reporters in the world after Syria.
In January last year seven employees of popular TV channel Tolo, which is often critical of the insurgents, were killed in a Taliban suicide bombing in Kabul in what the militant group said was revenge for "spreading propaganda" against them.
It was the first major attack on an Afghan media organisation since the Taliban were ousted from power in 2001.
Security in Kabul has been ramped up since a May 31 truck bomb exploded on the edge of the so-called "Green Zone", killing around 150 people and wounding 400 others.
That attack also caused extensive damage to 1TV, a private news channel near the bombing site. It also managed to resume operations within a few hours.
Special truck scanners, barriers and permanent and mobile checkpoints have been rolled out across the city since the May bombing.
But a suicide bomber struck again in Kabul's heavily fortified diplomatic quarter last week, killing at least five people.