Senior Chief Special Warfare Operator Kyle Milliken, 38, was killed in action Friday, about 40 miles west of Mogadishu during an operation against the East Africa-based jihadist group Al-Shabaab.
The statement says USA forces were conducting an advise-and-assist mission with Somalia's military.
The attackers were "neutralized" and the wounded service members were taken to neighboring Djibouti, said an official.
"We helped bring them in with our aircraft", Pentagon spokesman Capt. Jeff Davis said of the Somali forces in a statement.
U.S. helicopters transported Somali forces to the compound, in what Davis described as a "Somali mission".
"On May 5, the Somali national army killed an al Shabaab leader, Moalim Osman Abdi Badil, and three fighters", a statement from Somalia's information minister said.
It is the first US troop death there since 2006 when the military stood up US Africa Command (AFRICOM), defense officials said.
President Trump approved an expanded military role there some two decades after the USA largely pulled out following the shootdown of two helicopters in Mogadishu. His family has already been notified, but the Defense Department policy is to wait 24 hours after next-of-kin notification to release names of deceased servicemembers, the defense official said.
President Donald Trump recently approved an order that expanded USA authority in Somalia, allowing US aircraft to attack militants during offensive operations without presidential approval. The United States pulled out of Somalia after that incident in which two helicopters were shot down in the capital, Mogadishu, and bodies of Americans were dragged through the streets. No U.S. airstrikes were called in to support the ground forces.
The extremist group, which was chased out of Mogadishu years ago but continues to carry out deadly attacks there, has promised to step up the violence in response to the moves by Trump and Mohamed. The U.S.in recent years has sent a small number of special operations forces and counterterrorism advisers to Somalia and conducted a number of airstrikes.
USA forces are in Somalia to train local forces to combat the terror group, al Shabab, an al Qaeda affiliate that carried out the 2013 attack on Westgate Mall in Nairobi, Kenya killing 60 and injuring another 175. An unknown number of Somali army soldiers and al-Shabab militants were killed or wounded.
Somalia has been at war since 1991, when clan-based warlords overthrew dictator Siad Barre and then turned on each other.