Per U.S. military policy, the soldier's name will not be released until next of kin has been notified.
The US troops quickly found themselves on the receiving end of mortar and small arms fires, and in the ensuing fighting, one American soldier was killed, and four others wounded.
American forces under the United States military's Africa Command are partnering with African Union Mission to Somalia (Amisom) and Somali national security forces in counterterrorism operations, and have conducted frequent raids and drone strikes on Shabaab training camps throughout Somalia.
Three U.S. service members and the wounded partner force service member were medically evacuated to receive additional treatment, officials said.
The coalition forces were conducting a "multi-day operation" to clear al-Shabaab - an Islamist militant group - from villages and establish a "permanent combat outpost" around 217 miles southwest of Mogadishu.
Defense Department officials said at first that Somali government troops had led that operation, and al-Shabab militants had attacked US forces that were hanging back. The operation aimed to drive out the Somalia-based extremist group al-Shabab from contested areas.
Around 500 U.S. forces are stationed in Somalia.
Friday's incident marked the first time a USA service member has died in action in Somalia since Navy SEAL Kyle Milliken, a senior chief petty officer, was killed in May of a year ago in a firefight with al-Shabab militants.
President Donald Trump shared his condolences in a Twitter message Friday evening.
A U.S. Africa Command statement says the four wounded are now in the care of the U.S. Embassy medical team in neighboring Kenya. The group was blamed for a truck bombing in Mogadishu in October that killed more than 500 people and raised concerns about its ability to build larger explosives.
The US have been providing advice, assistance and aerial surveillance during the mission.
It was also a 3rd Special Forces Group team which was hit in Niger previous year, an ambush which killed four American soldiers and led to a massive investigation by the Pentagon. It was pushed out of Mogadishu in recent years but continues to control rural areas in the south and central regions.