Spain and Morocco will send troops to secure two Spanish enclaves on the north African coast, officials say.
Many migrants see Spain as "the promised land"
The move was announced as Spanish Prime Minister Jose Luis Zapatero met his Moroccan counterpart after five men died in the enclave of Ceuta.
Bullets that killed two of the African migrants were "not Spanish", Spanish investigators said on Thursday.
Two migrants died on Spanish soil and two in Morocco, as hundreds aiming to enter Spain rioted on Wednesday night.
Earlier, officials said the men died when they were crushed against fences separating them from Ceuta.
The clashes were the latest in a series of attempts by hundreds of Africans from all over sub-Saharan Africa to storm through the border and into Spanish territory.
CROSSING MELILLA'S FENCES
At their summit in Seville, Mr Zapatero and the Moroccan Prime Minister Driss Jettou announced they were both sending extra troops in an effort to secure the borders at Ceuta and another enclave, Melilla, where hundreds crossed the border earlier this week.
The BBC's Katya Adler says the summit was always going to focus on the issue of immigration.
Spain has praised Morocco for cracking down on flimsy boats and rafts manned by people traffickers, but it complains that illegal immigration in the enclaves of Ceuta and Melilla has dramatically increased.
It suspects that Morocco has not done its best to secure those borders since it disputes Spain's sovereignty over the enclaves, our correspondent adds.
More than 40 people, including policemen, have been injured in recent mass attempts to break through. Three other would-be immigrants have died since August.
Many migrants are caught and many drown while attempting to make the sea crossing to enter Spain illegally.
At least 28 would-be immigrants were being treated in hospital for injuries, the regional government said.
CEUTA AND MELILLA
Under Spanish rule since 15th Century; claimed by Morocco
3m (10ft) border fences being increased to 6m (20ft)
Linked to Spain by air and ferry services
Fence length: 9.7km (6 miles)
Fence length: 8.2km (5 miles)
Immigrants try to enter by scaling cliffs north of town, by swimming to beach south of town, or by crossing fence
Morocco and Spain are geographically so close that Africans pour into Morocco from all over the continent in an attempt to enter the European Union.
EU justice and home affairs commissioner Franco Frattini said on Thursday: "This tragedy, once again, bears witness to the urgent need for a genuine and effective management of migration issues."
Spain has recently raised the height of fences in Ceuta and Melilla and posted more soldiers there, while Morocco is putting a tighter watch on its coastline.
Over the last few weeks would-be immigrants have been using ladders and what Spanish officials have described as "military tactics" in their increasingly desperate attempts to get over border barriers.