Taliban has said in a statement that the group has stormed Ghazni City from different sides.
Muhammad Radmanish, a spokesman for the ministry of defence, said 27 Afghan soldiers were killed and five wounded.
Several bodies of dead Taliban fighters remained on the streets of Ghazni, the police chief said. Power has been cut to the area since fighting erupted. The militant group earlier said that hundreds of fighters had been involved and that government buildings, including the police headquarters, had been captured.
'We are scared for our life.
He said the bodies of 39 Taliban soldiers were recovered beneath a bridge in the southern edge of the city.
Another resident, Yasan, said the Taliban were using loudspeakers at the mosque to warn residents to stay in their homes. "We are terrified", Yasan wrote in a Facebook post.
In Ghazni, the attack began around 2 am (local time) with intense gunbattles raging and fires burning in several shops in the city's residential areas, provincial police chief Farid Ahmad Mashal told The Associated Press. "Our defense and security forces are in full control of the city", Rahimi said.
'Afghan forces held their ground and maintain control of all government centres.
"This is yet another failed Taliban attempt to seize terrain, which will result in yet another eye-catching but strategically inconsequential headline", he said.
20 die from landslides caused by relentless rain
Educational institutions have declared a holiday in Idukki , Kollam and other districts due to the incessant rains. Meanwhile, multiple incidents of landslips have been reported in the rural areas of Kozhikode district.
Lt. Col. Martin O'Donnell, a spokesman for USA forces in Afghanistan, said American forces and US attack helicopters flew in overnight. "There has not been a single minute of silence for the last eight hours", said a senior government official in Ghazni.
He said there were many challenges at the moment regarding the issue and that the "Taliban have also some kind of topic that some stakeholders can't accept".
Police special forces have also been deployed to help block the Taliban advance, an Afghan security official said.
At least 14 security forces were killed and 20 wounded in the battle, said Baz Mohammad Hemat, administrator of the Ghazni city hospital.
The insurgents frequently exaggerate their battlefield gains and downplay losses incurred during fighting.
Elsewhere in Afghanistan, a Taliban attack Thursday night in western Herat province left six policemen dead in the district of Obe, said the governor's spokesman there, Gelani Farhad.
An unprecedented truce in June brought fighting between security forces and the Taliban to a temporary halt, giving war-weary Afghans some welcome relief from violence.
The assault comes as pressure builds on the insurgents to enter peace talks.
The Taliban has long insisted on direct talks with the United States. US and North Atlantic Treaty Organisation forces remain in Afghanistan mainly in a supporting and training role in the 17-year-old war.