About 100 migrants tried to storm the barbed wire fence at dawn but Spanish and Moroccan security force prevented "around half" from entering Melilla, Spain interior ministry in Melilla said in a statement.
Police arrested one of the migrants for assaulting an officer.
The 52 who managed to enter Melilla were taken to a temporary migrant accommodation centre where they were given new clothes.
It was the biggest assault on the border between Melilla and Morocco since October 2018, when some 300 migrants stormed the fence. About 200 migrants manged to get into Melilla that time and one died of a suspected heart attack in the attempt.
Spain's two North African enclaves, Melilla and Ceuta, have the European Union's only land borders with Africa.
They are often used as entry points into Europe for African migrants, who either climb over their border fences or try to swim along the coast.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)