"It was suicide attack by a bomber who pretended to be worshipper," said Haruna Dawud, a trader at the Monday Market which is next to the mosque.
The Monday Market has over the past year been hit by several suicide bombings blamed on Boko Haram.
The terrorists launched an overnight attack on Maiduguri on Saturday but were repelled by the military.
Dawud said he saw 20 bodies being evacuated after the blast at roughly 3:30 pm (1430 GMT) but could not confirm how many were dead.
Sada Umaru, a trader who participated in the rescue operation, also said the death toll may reach 20 or higher, but like Dawud, was not able to confirm a specific toll amid the chaos that followed the blast.
Umaru confirmed the accounts of other witnesses that the attacker entered the mosque pretending to be a worshipper who had come for afternoon prayers.
The bombing and the thwarted Boko Haram attack on Maiduguri came hours after Nigeria's President Muhammadu Buhari was sworn into office, vowing to crush the terrorists group.