About 1,000 Africans rushed the triple-layer fence separating the Spanish city from Morocco in a "violent" assault around 0700 GMT and half of them made it across, said the Spanish governor of Melilla, Abdelmalik El Barkani.
"Helped by the bad weather and fog, a big group of about 1,000 tried to enter and about 500 sub-Saharans succeeded," he told a news conference.
He said the attempt, the latest in a string of desperate bids by Africans trying to reach Europe, was "one of the biggest in recent years".
Spanish and Moroccan officials said some of the migrants threw stones at security forces.
The Moroccan interior ministry said five police officers were hurt.
It added that 102 migrants were arrested, including 28 who were injured by barbed wire on the top of the fences and were taken to hospital in the nearby Moroccan town of Nador for treatment.
A further 150 migrants were arrested overnight in an earlier failed attempt to scale the fences, the ministry said.
Melilla forms one of Europe's only two land borders with Africa, along with another Spanish territory, Ceuta, to the west.
The two cities sit across the Mediterranean from mainland Spain, surrounded by Moroccan territory, and are a key entry point for migrants seeking a better life in Europe.
The number of Africans trying to cross into the territories has surged over recent months.
Scores have been injured in the attempts.
More than 200 migrants stormed over the fence into Melilla on February 28, leaving 35 injured according to officials and rights groups.
Others have tried to sail to Spain's north African territories or to the mainland in flimsy vessels or enter the country hidden under car seats.
On February 6th about 15 migrants drowned in Moroccan waters while trying to swim to Ceuta from a nearby beach.
Rights groups and witnesses accused Spanish security forces of firing rubber bullets at the migrants in the water.
The government admitted using rubber bullets but denied its forces had targeted the migrants directly.
It later banned civil guards policing the border from using rubber bullets to repel migrants.