In all, more than 300 immigrants tried to climb over the six-meter-high fence using hooks. 238 men succeeded.
Three police officers were slightly injured in an attempt to prevent this.
The Spanish enclaves of Melia and Ceuta on the Mediterranean coast of North Africa are constantly being used by African immigrants to enter the European Union (EU) illegally.
In May, when Moroccan authorities seemed to ease controls for a few days, some 8,000 illegal immigrants entered Ceuta and Melilla. Spain had to send an army and additional police forces there.