"At around 7:00 am about 150 migrants launched an assault and we estimate that around 60 managed to enter. We are waiting to get more data and specific details," a spokeswoman for Melilla town hall said.
The Spanish government representative in Melilla, Abdelmalik El Barkani, said the migrants were "very violent" as they threw stones and struck police who tried to stop them from getting over the fence from the Moroccan side.
"Once they crossed over many of them spread out and tried to hide inside homes, local residents then called police and emergency services to warn that they were there," he told journalists.
At least "six or seven" people were treated in hospital for light injuries, including a police officer, El Barkani said.
More From This Section
About four hours earlier, another group of around 300 migrants tried to storm the border but no one managed to get in.
In a bid to ward off migrants, Spain last year began to put barbed wire along Melilla's 11-kilometre border fence, drawing complaints from human rights groups.
Barbed wire had been used before in Melilla but was removed from the top of the border fence in 2006 after causing injuries to migrants as they tried to enter the territory illegally.
About 3,000 migrants tried to scale the border fence between January 1 and September 17, compared to 1,610 during the same period last year, according to Spanish interior ministry figures.
Melilla and Ceuta, another Spanish territory on the north African coast, have the European Union's only land borders with Africa.
They are seen as stepping stones to Europe by African immigrants since detention centres in the two territories send would-be migrants over to the Spanish mainland once they become too overcrowded.