The Taliban claimed responsibility for the shooting, the latest in a rising number of so-called "green-on-blue" attacks in which Afghan security forces, or insurgents disguised in their uniforms, kill their U.S. or NATO partners.
The international military coalition did not disclose the nationality of the service member killed, but a U.S. official said he was American.
A second American official said two U.S. service members were wounded.
The officials spoke on condition of anonymity because they were not authorized to disclose the information to reporters.
So far this year, 27 coalition troops have been killed in 20 such attacks, according to an Associated Press tally. That compares with 11 fatal attacks and 20 deaths the previous year. In 2007 and 2008 there was a combined total of four attacks and four deaths.
Overall this year, 272 U.S. and NATO troops have died in Afghanistan.
Taliban spokesman Zabiullah Mujahid said in a statement that one Afghan soldier killed nine U.S. troops. The Taliban often exaggerate the death tolls from their attacks.
"The soldier who opened fire on the Americans had long been in contact with Taliban in the area," Mujahid said. "The soldier has escaped and has joined the Taliban."
The second U.S. official said both of the gunmen in Afghan army uniforms were in custody.
The Taliban also claimed responsibility for Tuesday's mid-morning blast at a NATO base in Logar province, southeast of Kabul.
A suicide attacker, who placed explosives under a load of gravel, drove a pickup truck into a gate of the base near Logar's capital of Pul-i-Alam, provincial police chief Ghulam Sakhi Roogh Lawanay said. At least 11 Afghan civilians were wounded, he said.
Earlier, a remote-controlled roadside bomb struck a bus traveling northwest of Kabul, killing at least nine passengers, police said. The militant who set off the device was captured by local villagers in Paghman district of Kabul province.
The bomb exploded when the bus drove over a bridge, said Mohammad Zahir, the criminal director for Kabul police. Broken glass and abandoned shoes of victims littered the road near the bus, which was flipped onto its side.
The latest shooting of a NATO soldier was a setback for the Afghan National Army just as the Defense Ministry lost its leader.
Lawmakers passed no-confidence votes Saturday against Wardak and Interior Minister Bismullah Khan Mohammadi, faulting them for what they said was the government's weak response to cross-border attacks that Afghans blame on the Pakistani military.
"As an Afghan citizen, I believe in democracy and I respect their (the parliament's) decision," said Wardak, explaining why he was stepping down instead of continuing as a caretaker minister, as President Hamid Karzai offered.
Wardak served in the Afghan government through more than four decades of national turmoil. He oversaw growth of the army from around 50,000 to more than 195,000, but it remains plagued by corruption and unprofessionalism.
Wardak studied in the U.S. and speaks fluent English. He had the backing of Washington and the NATO military coalition.
As Wardak spoke, another member of Karzai's Cabinet was defending his record.
Finance Minister Omar Zakhilwal asked government prosecutors on Tuesday to investigate allegations against him of wrongdoing involving bank deposits and transfers. He denied the allegations and said an investigation would clear his name. The government's anti-corruption unit is looking into sizable deposits to Zakhilwal's bank accounts. The country's Tolo Television, first to report the probe last week, displayed copies of bank statements from 2007 to 2011 that Tolo said showed more than $1 million being transferred to Zakhilwal, some of which it said was later moved out of the country.
Zakhilwal has said he earned the money from his work as a consultant for international institutions and as an author.
Intellpuke: You can read this article by Associated Press Writer Deb Reichmann, reporting from Kabul, Afghanistan, in context here: www.guardian.co.uk/world/feedarticle/10378722
Associated Press Writers Rahim Faiez. Amir Shah and Kay Johnson, reporting from Kabul, Afghanistan, and Pauline Jelinek and Lolita Baldor, reporting from Washington, D.C., contributed to this report.