The attack started with a gunbattle as the assailants tried to shoot their way in to the compound in the Taimani neighborhood about 3:30 p.m. (1100 GMT, 7 a.m. EDT), said Abdul Ghafar Sayedzada, chief of criminal investigations for the Kabul police.
After the assault, a group of men could be seen carrying a body out of the building toward a waiting police truck. One of the men carrying the body was weeping, according to an Associated Press reporter at the scene.
The attack appeared timed to coincide with the end of the company's workday, Sayedzada said.
Area residents said they heard shooting about the same time as the blast.
"I was about to park my car when I heard gunfire. I turned and saw shooting between the security guards and two other people. They were trying to get in the building," said Mohammad Sharif, who lives nearby. "In the middle of that fighting suddenly there was a big explosion."
One of the security guards was also wounded, Sayedzada said. They all worked for a foreign company, Hart Security, he said.
The Afghan capital is heavily fortified but has still been attacked multiple times this year by insurgents.
In one of the worst incidents in February, insurgents used a car bomb and militants in suicide vests to kill at least 16 people - half of them foreigners - in the heart of Kabul.
The Afghan government has since stepped up police checkpoints to create what it calls a "ring of steel" around the capital.
Rockets hit a national peace conference in June, and security officials have said they thwarted planned suicide attacks in Kabul during a recent international conference on the future of Afghanistan.
Also Tuesday, the United Nations released a report showing the number of civilians killed in the Afghan conflict in the first six months of the year rose 25 percent compared with the same period a year ago, with insurgents responsible for the spike.
The report showed a reduction in civilian casualties from NATO action, but the overall rise in deaths indicated that the war is getting ever-more violent - undermining the coalition's aim of improving security in the face of a virulent Taliban insurgency.
"The human cost of this conflict is unfortunately rising," said Staffan De Mistura, the top U.N. envoy in Afghanistan. "We are very concerned about the future because the human cost is being paid too heavily by civilians. This report is a wake-up call."
According to the U.N. report, 1,271 Afghans died and 1,997 were injured - mostly from bombings - in the first six months of the year. There were 1,013 civilian deaths in the first six months of 2009.
The U.N. said insurgents were responsible for 72 percent of the deaths - up from 58 percent last year.