"We first attacked the base with a suicide car bomb and then stormed. We killed 27 soldiers and took the base. Some soldiers fled into the jungles," Abdiasis Abu Musab, the group's militant operations spokesman said.
The base, which was also attacked by the al-Qaeda linked militants in June, is some 50km away from the southern port city of Kismayo.
Somali military forces in Kismayo confirmed that an attack took place.
"We have sent reinforcement to the base," Majo Aden, a Somali military officer, told Reuters.
"We understand there was an explosion and heavy fighting between al-Shabab - who attacked the base - and the Somali forces. We have no details so far."
Al-Shabab - which is often referred to as "the deadliest" Islamist extremist group in Africa - is fighting to impose its hardline interpretation of Islamic law across Somalia.
The group was blamed for the country's worst ever terror attack, when a truck bombing left more than 500 dead in October last year.
Last week, the group's Kenyan branch, al-Hijra, was proscribed as a terrorist group by the US.
"Terrorism designations expose and isolate organisations and individuals, and deny them access to the US financial system," the State Department said in explaining the move.
"Moreover, designations can assist the law enforcement activities of US agencies and other governments."