A video filmed by a rights group on October 15th showed Spanish Civil Guards beating an African migrant as he hung on the fence separating Morocco from the Spanish territory of Melilla, and then carrying him apparently unconscious back to the Moroccan side.
The video sparked cries of outrage from rights groups and the United Nations High Commission for Refugees, while the EU on Tuesday warned that Spain could not use force stop migrants from trying to enter the country.
The Spanish government insisted its officers had acted legally and complained that the border fence is under intense pressure from the flow of migrants.
In a statement late on Wednesday the interior ministry said it had drawn up new instructions for border guards that will be included in a forthcoming immigration reform.
It said the guards' mission is to "prevent the illegal entry of people" into Melilla and Spain's other north African enclave, Ceuta, which together have Europe's only land borders with Africa.
The ministry said surveillance and coordination with Moroccan security forces would be stepped up to provide early warnings of attempts by migrants to scale the seven-metre (23-foot) triple-layer fence.
"In cases where migrants' violent behaviour obliges officers to use equipment to keep order, their actions will conform to the principles of timeliness, coherence and proportionality, taking care at all times to minimize injuries," the statement said.
It said officers must take care to avoid migrants and police falling from the fence and must call for medical assistance for any migrants who get hurt.
The government has been criticized for so-called illegal "on-the-spot deportations" of migrants who have stormed the border fence in groups of hundreds over recent months.
The government denies that migrants who climb the fence should be considered as having reached Spanish territory and says it has the right to return those intercepted while perched there.
It said the new guidelines would consider an immigrant to have illegally reached Spain if they "get completely past the perimeter security system". In those cases, the immigrants will be taken to a police station to be registered.
Spain has demanded more help from the European Union to deal with the flow of migrants trying to get into Melilla and Ceuta, which has swelled over recent months.
In the latest attempt, two migrants were taken to hospital after about 200 of them tried to storm the fence into Melilla on Wednesday morning, Spanish government officials in the territory said in a statement.
About 20 made it across and dozens of others sat perched on the top of the fence for hours.
Nearly 2,000 African immigrants have managed to enter Melilla, a city of about 80,000 people, so far this year, the statement said.