Irene Flores, spokeswoman for the local government, said a group of around 120 people from Sub-Saharan Africa stormed the six-metre (20-foot) high fence early on Sunday morning.
"Only 30 managed to get through the whole system and get to Melilla," she said, adding they had gone to a local centre for migrants and refugees.
Melilla and Ceuta, another Spanish enclave nearly 400 kilometres (250 miles) away, have for some years been a flashpoint for African migrants trying to enter Spain, with authorities stepping up security by strengthening border barriers.
The border system in Melilla is composed of two six-metre-high fences, with a criss-cross of steel cables in between.
Sunday's incident brings to 10 the number of attempts to storm this fence this year, with some 50 migrants managing to get into Melilla, Flores said.