Local residents reported heavy blasts and gunfire at Baledogle airport in the southern Lower Shabelle region.
The al-Shabab militant group said it had carried out the attack, using a car bomb to blast through the gates before sending its fighters inside.
Military officials say the jihadists were repulsed without breaching the perimeter fence.
No casualties were reported among the Somali military.
In a statement, US Ambassador Donald Yamamoto praised the Somali military for their "alertness and swift response".
"This attack yet again demonstrates al-Shabab violently opposes progress towards peace and prosperity in Somalia," he said.
The US remained committed to building "a stronger and prosperous Somalia that offers a brighter future for its people".
Al-Shabab said in a statement it had launched the raid and that it was ongoing.
"After breaching the perimeters of the heavily fortified base, the mujahideen [holy warriors] stormed the military complex, engaging the crusaders in an intense firefight."
The base, about 100km (60 miles) west of the capital Mogadishu, is said to house US special forces, Somali special forces and Ugandan peacekeepers. It is used as a launch site for US drones as well as being a training centre.
Separately, an Italian military convoy was hit by an explosion in Mogadishu itself, Italy's defence ministry said. No casualties have as yet been reported in this attack.
The US has sharply increased its air strikes against al-Shabab, which is linked to al-Qaeda, since President Donald Trump took power.
Officials in Somalia say the group has increased its attacks in Mogadishu as retaliation for the air strikes.
BBC Africa editor Mary Harper says the fact that al-Shabab was able to hit two foreign targets on the same day shows it is a co-ordinated force with excellent intelligence.
The US state department says al-Shabab retains control over large parts of the country and has the ability to carry out high-profile attacks using suicide bombers, explosive devices, mortars and small arms.