An explosion was heard at 11:40 local time (07:10 GMT) and sporadic gunfire continued for over six hours before officials declared the incident over.
A ministry source said one of the attackers got inside the building.
The attack comes a day after talks between Afghan officials and the Taliban were suspended, but the Taliban said they were not behind the assault.
Among the dead were four civilians and three police officers, while another eight civilians were wounded.
Although Kabul still sees fighting, this attack follows months of relative calm.
What’s happening on the ground?
The attack happened in a busy area of central Kabul, near one of the city’s most popular hotels, a couple of other ministries, and the presidential palace.
There were four attackers in total – all of whom were eventually shot dead by police officers.
The Serena Hotel, which is heavily fortified, is one of the few still used by foreign visitors.
At 18 storeys high, the information ministry building is believed to be one of the tallest in Kabul.
About 2,000 people were feared to have been stranded inside for hours, until they were eventually freed.
Footage broadcast on local TV showed a small cloud of smoke rising near the tower block, while people climbed out of the windows of one of the lower levels, AFP news agency reported.
Hundreds of civilians were evacuated from the building, the ministry said, but eight people were injured and taken to hospital.
Who is responsible?
The Taliban’s spokesman, Zabiullah Mujahid, said the organisation was not behind Saturday’s attack.
The Afghan branch of the Islamic State group has carried out a number of deadly attacks in Kabul but has not so far said it was behind this one.
Where are we with peace talks?
The US and the Taliban have been involved in attempts to negotiate a peace process. The sides have held five rounds of direct talks since October 2018, and are now in the middle of their sixth.
A conference between officials from the militant group and about 250 Afghan politicians had been due to take place in the Qatari capital Doha on 20 and 21 April.
But the meeting was abruptly called off on Thursday after the Taliban complained about the size and status of the Afghan delegation.
In a statement, the Taliban accused the Afghan government of “sabotaging this conference and peace efforts”.
The goal is to resolve Afghanistan’s civil conflict and negotiate the withdrawal of US forces in the country.
The US also wants the Taliban to guarantee that Afghan territory won’t be used by foreign militants, and that they won’t pose a security threat to the rest of the world.
In 2001 a US-led military coalition overthrew the Taliban for sheltering al-Qaeda, the militant group behind the 9/11 attacks.
US officials say the conflict in Afghanistan now costs them about $45bn (£34bn) a year.
The Taliban currently control and influence more territory than they have at any point in the past 18 years.