Around 300 sub-Saharan African migrants attempted to force their way across the fence in a coordinated operation.
Around 300 sub-Saharan African migrants attempted to force their way across the fence at about 7am (0500 GMT) in a coordinated operation, a Spanish police spokesman said.
"Around 100 managed to enter Melilla," he told AFP.
The barrier is composed of two six-metre-high (20-feet-high) fences, with criss-crossing steel cables in between. In order to get across, migrants often use hooks and shoes studded with nails.
Three policemen were injured in clashes with the migrants, who kicked and threw rocks at the officers, Spain's interior ministry said in a statement.
One of the officers was injured in the hand by one of the hooks used by migrants and several police vehicles were damaged, it added.
Three migrants suffered bruises and small cuts in the attempt to cross the border, said a Red cross spokesman in Melilla.
Melilla and Ceuta, another Spanish enclave nearly 400 kilometres (250 miles) away on the north coast of Africa, are often used as entry points into Europe for African migrants.
They have the only two land borders between Africa and the European Union.
Thousands of migrants have attempted to cross the 12-kilometre (7.5 mile) frontier between Melilla and Morocco, or the eight-kilometre border at Ceuta, by climbing the border fences, swimming along the coast or hiding in vehicles.
In February around 850 migrants managed to storm across the border into Ceuta over four days.
Spain announced in March that it would nearly double the capacity of its migrant reception centres in the two territories to 8,500 places from 4,500.
Spain has drawn criticism from human rights groups for allowing some migrants to be immediately turned back to Morocco in such incidents. They argue that skipping the lengthier deportation procedures deprives people of the opportunity to claim asylum.