The group claiming responsibility, formerly known as the Salafist Group for Preaching and Combat (GSPC), was behind similar attacks in recent months, including a triple suicide bombing in Algiers that killed 33 people on April 11.
In an audio tape, a spokesman for the armed group said: "Our martyr was able to enter into the heart of the [barracks] and set off the explosion there."
The spokesman named the attacker as Suhail Abu Malih and said more than one tonne of explosives were used.
The owner of a coffee shop in Lakhdaria said: "I heard a terrible explosion. I first thought it was an earthquake but soon I found out it was an attack against the barracks."
The bombing came on the same day as the opening of the Africa Games, one of the continent's biggest sporting events, which is taking place in Algiers and also in Blida and Boumerdes, two towns in Kabylie.
|"This attack will not prevent us from continuing our relentless fight against terrorism"|
Noureddine Yazid Zerhouni, Algeria's interior minister
Abdelaziz Bouteflika, the Algerian president, asked the army in early July to step up attacks on armed groups, saying they were "enemies of the people".
Noureddine Yazid Zerhouni, the interior minister, told Algerian radio that the blast had caused a number of casualities.
He also said: "This attack will not prevent us from continuing our relentless fight against terrorism."
Anis Rahmani, a security expert, said the attack, which occurred three months to the day after the April 11 blasts, appeared to show that al-Qaeda was now firmly set on using suicide bombers in the Muslim country.
He said: "The suicide attack was expected, particularly after the security services succeeded in preventing any [suicide attacks] in the intervening 90 days."
The April 11 blasts were the first intended suicide bomb attacks since violence began in Algeria in 1992, journalists say.
Up to 200,000 people have been killed in political bloodshed in Algeria since 1992 when supporters of a now-outlawed party that was poised to win elections that year subsequently launched an armed rebellion against the state.
The violence has subsided in recent years but sputters on mainly in Kabylie and nearby areas.