The unrest broke out in Gourougou forest overlooking the enclave where migrants gather waiting for a chance to sneak into Melilla as a passage to Europe.
The fighting between migrants from Mali and Cameroun left 20 people in need of hospital treatment, local authorities said, quoted by Morocco's MAP news agency.
Melilla is one of two Spanish-held cities on the northern coast of Africa, along with Ceuta to the east. The number of Africans trying to cross into them has surged over recent months.
On May 28, about 500 African migrants climbed over the seven-metre (23-foot) triple-layer border fence into Melilla one of the biggest breaches in nearly a decade.
Spain has asked for more money from the European Union to secure its borders. Officials say the immigrant reception centre in Melilla is highly overcrowded.