The blast happened on the last morning of U.S. Defense Secretary Robert Gates' two-day visit to Afghanistan, but it was not immediately clear if he was still in the country at the time. The Taliban claimed responsibility for the attack.
The suicide bomber was in a Toyota Corolla that struck a minibus full of soldiers in the Chihulsutoon area south of Kabul, said Aziz Ahmad, an Afghan army officer at the site of the blast.
Six soldiers and seven civilians were killed in the blast, and seven other soldiers were wounded, said Defense Ministry spokesman Gen. Mohammad Zahir Azimi.
At least 13 civilians also were wounded in the attack, said Abdullah Fahim, a spokesman for the health ministry. Four children were among those killed, Fahim said.
Purported Taliban spokesman Zabiullah Mujaheed claimed responsibility for the blast in a text message sent to an Associated Press reporter in neighboring Pakistan . Mujaheed identified the bomber as Abdul Rahman, a resident of eastern Khost province.
The minibus was demolished, and its mangled frame lay on the side of the road as the wounded were whisked to hospitals.
The blast was third suicide attack in the city in the last eight days. It follows a similar attack against a NATO convoy on Tuesday, that left 22 civilians wounded.
Local resident Amir Mohammad said he helped load the bodies of the six slain Afghan soldiers into ambulances.
Mohammad Amin, who runs a bakery close to the blast site, said two of his employees were wounded by flying shards of glass.
"Every day this bus stops in front of my bakery to take employees of defense ministry," Amin said. "Suddenly today a very strong explosion hit the bus," Amin said.
Mohammad Ashraf, a 13-year-old boy, was praying inside the mosque when the flying shrapnel and glass cut through his flesh, his father Mohammad Akram said.
"My other 8-year-old son was also wounded in the same mosque," Akram said.
There has been a spate of attacks in recent months on buses carrying Afghan security forces as they commute to work in the morning.
On Sept. 29, a suicide bomber blew himself up inside an army bus in Kabul, killing 28 soldiers and two civilians. In June, another bomb ripped through a bus carrying police instructors in Kabul, killing 35 people.
Militants have launched more than 133 suicide attacks this year - a record number. At least 6,200 people have died in insurgency-related violence in 2007, also a record, according to an Associated Press tally of figures from Afghan and Western officials.
Suicide attacks frequently target international and Afghan security forces, but most of the casualties are civilian passers-by.
Gates, the U.S. defense secretary, was scheduled to leave Kabul on Wednesday morning, and it was not immediately clear if Gates was still here at the time of the blast, a U.S. embassy official said on condition of anonymity because he was not authorized to speak on the subject.
In southern Afghanistan , U.S.-led coalition troops killed several Taliban militants during raids on compounds in Garmser district on Wednesday, the coalition said in a statement.
The troops "targeted an individual believed to be associated with weapons smuggling operations in the province," it said. "While performing a search of one of the compounds, coalition forces killed several armed militants who posed an imminent threat."
Separately, an explosion struck a patrol of NATO-led troops in southern Afghanistan on Tuesday, leaving one soldier killed and two others wounded, the alliance said in a statement. The soldiers' wounds were not life-threatening, the statement said.
NATO did not disclose the nationalities of the dead and wounded soldiers or the exact location of the attack.