The raid comes six months President Muhammadu Buhari said Boko Haram had "technically" been defeated by a military campaign that had pushed many jihadists deep into the remote Sambisa forest, near the border with Cameroon.
Aid workers and Reuters witnesses reported explosions and heavy gunfire for at least 45 minutes in the southeastern and southwestern outskirts of the city. Thousands of civilians fled the fighting, according to Reuters witnesses.
Nigeria's military said it had contained the attack.
"The situation in Maiduguri is under control," it said in a statement, urging the city's inhabitants not to panic.
Maiduguri in Borno state has been the epicenter of the eight-year fight against Boko Haram but has been relatively free of violence since the beginning of 2016, barring sporadic suicide bombs on its outskirts.
Fighter jets roared overhead as soldiers and police sped toward the scene, the Reuters witnesses said. Three children were hit by bullets, one witness said.
More than 20,000 people have been killed in Boko Haram's campaign to establish a mediaeval caliphate in the Lake Chad basin. A further 2.7 million have been displaced, creating one of the world's largest humanitarian emergencies.
Despite the military's success in liberating cities and towns, much of Borno remains off-limits, hampering efforts to deliver food aid to nearly 1.5 million people believed to be on the brink of famine.