Local authorities were unable on Monday to explain how the immigrants managed at dawn to break through or over the fence, whose height had been raised to 6m, in the latest in a series of assaults on the barrier.
The Spanish Interior Ministry office in Melilla said 650 people tried to cross over and about 350 succeeded.
During the incident, many of the immigrants turned violent as police tried to round them up, and many threw rocks at the officers.
Hours after the surge, shoes, gloves, shirts and other pieces of clothing, many blood stained from cuts, dangled from the barrier.
Crude ladders made from branches that the immigrants used to scale the outer fence were seen stacked on the Moroccan side of the border.
Blood could be seen in several places on the ground and along the guard rail of a road running parallel to the fences.
In a statement, the interior ministry said 135 were treated for injures, although only five were kept in hospital for observation. Seven police officers were also injured.
Melilla, which with Spain's other enclave of Ceuta, is the only part of the European Union to share a land frontier with Africa.
The Moroccan authorities confirmed the invasion of Melilla.
"About 300 people from the sub-Sahara conducted a massive assault on the Melilla fence," an official in Nador, the Moroccan town neighbouring Melilla, said by telephone.
He said the authorities had opened an inquiry into the event.
"We were just tired of living in the forest"
Immigrant from Guinea Bissau
"We were just tired of living in the forest", said Sega Sow, a 19-year-old from Guinea Bissau whose sports jersey and pants were soaked in blood. He had bandages on both arms and his head.
"There was nothing to eat, there was nothing to drink." The charge took place at a part of the fence that had been raised in recent weeks.
Sow and others said they chose the spot because there were no police on the Moroccan side.
Notice of expulsion
About 300 of those entering Melilla headed for the police station to register and to be given notice of expulsion, a procedure which gives them access to the local reception centre, medical aid and possible entry to the European Union.
The latest assault on the barrier took place at 5.15am (0315 GMT) in spite of the deployment by Spain of 480 troops and by Morocco of 1600 police officers to prevent such attempts, usually by would-be immigrants from sub-Saharan Africa, to break into the enclaves.
Prime Minister Jose Luis Zapatero:
Raised barrier will end invasions
Last Thursday, five people died during an attempt to break into Ceuta by about 500 people, 200 of whom managed to scale the barrier.
Spain has speeded up the increase in the height of the border fence, due to be completed within the next few months.
Last week Spanish Prime Minister Jose Luis Rodriguez Zapatero said he was confident that the series of mass invasions were "occasional" and would end once the work was completed.
The president of Melilla, Juan Jose Imbroda, said on Monday that the solution had to come "from the other side of the frontier", referring to Morocco.
"There was not much collaboration [by the Moroccans] tonight and what happened, happened," he told a Spanish radio station.
Last Tuesday about 300 illegal immigrants broke into Melilla in two mass attacks on the barrier, involving about 1000 people.
In August, three people died in the frontier zone of Melilla in controversial circumstances.
"The solution has to come from the other side of the border"
Juan Jose Imbroda,
Mayor of Melilla
Imbroda said the solution was not to deploy army troops, but to achieve better cooperation with Morocco in stemming the flow of Spain-bound immigrants.
"The solution has to come from the other side of the border," he told Cadena Ser radio. "I don't know if the Moroccan forces are deployed somewhere else or they let down their guard."