About 200 migrants managed to scale the seven-metre high metal barrier and were taken to a reception centre in Melilla where officials started the process of identifying them.
The man died of a suspected cardio-respiratory arrest despite being treated by emergency services, the Spanish government's local delegation said in a statement.
More than 6,000 migrants have made it to Melilla and Spain's nearby territory Ceuta so far this year, according to the U.N. refugee agency UNHCR. In some places, the fences around the enclaves are topped with razor wire.
On Sunday, wooden-handled hooks and shoes fitted with spikes to help the climb were left behind, along with a bloodied t-shirt.
More than 40,000 have arrived by sea on Andalucia's southern coast since January, making Spain Europe's top destination for migrants which the European Union has failed to agree on how to handle.
The routes have changed as Italy clamped down on rescue ships to dock at its ports, and a deal between the EU and Turkey eased flows across the Aegean Sea to Greece.
The vast majority of arrivals in Spain are men, primarily from Guinea, Mali and Morocco, the UNHCR says.
On Saturday, Spain returned to Morocco 24 migrants who reached the Chafarinas islands, another Spanish territory off the North African coast, under a bilateral agreement signed in 1992, under which citizens of third countries who have entered illegally can be returned within a certain time frame.This agreement was very rarely used until this summer, when 116 men who stormed the Ceuta fence were turned back. Spain's Interior Ministry says it is being used now thanks to good bilateral relations.