The Algerian interior ministry said the attack was carried out by two people who killed themselves in the attack.
It was not immediately clear if they were included in the death toll of 30 published by the ministry.
It said 47 people were wounded.
Most of the dead were members of the naval coastguard but civilians were also among the injured, the AFP news agency said.
A van normally used to deliver supplies to the naval barracks crashed through the rear entrance before exploding, according to witnesses.
The vehicle, which had reportedly been hijacked earlier, was packed with explosives.
The force of the explosion flattened many of the prefabricated buildings that make up the barracks, witnesses said. The port was cordoned off as police sifted through the rubble.
Mahmoud Belhimer, from Algeria's El Khabar newspaper, told Al Jazeera earlier on Saturday that many believed that al-Qaeda Organisation in the Islamic Maghreb was behind it.
He said the bombing was similar to attacks that took place in April this year which the GSPC claimed to have carried out.
Those bombings, outside the prime minister's office in Algiers and a police station on the outskirts of the capital, killed 32 people.
Belhimer said Thursday's attack in Batna likewise bore all the hallmarks of al-Qaeda.
Most of the victims there were waiting for for an official visit by Abdelaziz Bouteflika, Algeria's president, who was on a three-day tour of eastern Algeria.
Bouteflika blamed Islamist groups for the blast, denouncing them as "criminals" trying to harm his policy of national reconciliation.
On Saturday, Al Jazeera said the banned Algerian Islamic Salvation Front had strongly condemned the Batna bombing.
Abassi Madani, head of the organisation, said in a statement that what was happening in Algeria proved that the country's crisis was going to get worse as long as its main causes were not seriously addressed.
Noureddine Yazid Zerhouni, the Algerian interior minister, had earlier said that the National Reconciliation Act prohibits former members of the Salvation Front from returning to political activity through the establishment of a new party.
On Friday, Zerhouni urged those responsible for the Batna attack to turn themselves in. He said the perpetrators have "one choice: turn themselves in, or die".
Source: Al Jazeera and agencies