The multinational force "came under mortar and small-arms fire at approximately 2:45 pm Mogadishu time (1145 GMT), killing one U.S. service member and injuring four USA service members and one partner force member", the United States military's Africa Command said in a statement.
The firefight marks the second deadly incident for US troops in Africa since October 4, 2017, when four USA service members were killed during an ambush by ISIS fighters in Niger.
USA troops with Somali and Kenyan forces came under mortar and small-arms fire and one "partner force member" also was wounded in the attack about 217 miles southwest of the capital, Mogadishu, the us military said.
One US service member reportedly received sufficient medical care at the scene and three others were transported out of the area to receive treatment.
AFRICOM has conducted several airstrikes in Somalia recently, including a June 2 strike that killed 27 al-Shabaab militants southwest of Bosasso. The U.S. provided advice, assistance and aerial surveillance during the mission, the statement said.
Earlier this month, al-Shabab claimed a series of attacks across the country, according to the SITE Intelligence group.
Marine Corps Gen. Thomas D. Waldhauser, who heads U.S. Africa Command, said at a Pentagon press conference that he had taken steps to better ensure the safety of U.S. service members in future operations.
The American forces were operating alongside Somali troops. The US had pulled out of the country after 1993, when two helicopters were shot down in Mogadishu and bodies of Americans were dragged through the streets.
U.S. President Donald Trump expressed his condolences to the family of the deceased soldier in a tweet. 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.
Al-Shabab, linked to al-Qaida, seeks to establish an Islamic state in Somalia.
Hundreds of newly trained al-Shabab fighters perform military exercises in the Lafofe area south of Mogadishu, Somalia, on February 17, 2011. Some of al-Shabaab's top leaders have been killed in USA drone strikes, but its operations have continued in Somalia despite the resistance.
Somali officials have said civilians have been killed in more than one joint US military operation with Somali forces.
However, it still has a strong presence in regions around the capital.