"Three died on the Moroccan side of the border and two on the Spanish side," Spain's Deputy Prime Minister Maria Teresa Fernandez de la Vega told reporters at a Moroccan-Spanish summit. Ninety-one were injured, she said.
Two were killed on the Spanish side, from suffocation or from being crushed in the stampede when around 500 people stormed the metal barrier separating the two countries early on Thursday.
Two off the three died on the Moroccan side shot by rubber bullets.
The bodies of the dead were taken to a hospital in the northern Moroccan city of Tetouan.
Spain's other North African enclave, Melilla, has seen numerous mass attempts by would-be immigrants to storm across the border fence from Morocco in recent weeks.
Spain recently praised Morocco
for controlling illegal immigration
In Morocco's Tetouan hospital, injured immigrants complained to AFP that Spanish border guards had fired on them with rubber bullets, tear gas and had shot live ammunition in the air.
"They were inhuman. Never would I have thought that the Spanish would do so much harm to Africans," said Ayno Kan, a young Senegalese emigrant.
Just hours after the incident, Spanish officials in Melilla said that Moroccan security services had arrested 220 people in a massive operation on Thursday to prevent an attempt by
would-be immigrants to break into Spain's second enclave.
Morocco deployed 500 officers and three helicopters to prevent the assault, in the largest ever operation of its kind in the country, the official said.
Those arrested were most sub-Saharan Africans, and faced being escorted to the Algerian border, the Spanish official said.
Zapatero (R) met Jettou in
Seville to discuss issue
Meanwhile, in the southern Spanish city of Seville, Spanish
Prime Minister Jose Luis Rodriguez Zapatero met his Moroccan counterpart Driss Jettou for talks on illegal immigration, with the overnight violence high on the agenda.
Spain's deputy prime minister De la Vega said that Spain would send an additional 480 soldiers to bolster the garrisons in Ceuta and Melilla and promised an investigation and full transparency from the Spanish government.
Spanish border guards have been called on to repel immigrants' attempts to scale the fortified border-crossing with makeshift wooden ladders and human-rights group have complained about the use of excessive force.
Spain decided earlier this month to double the height of the chain-link fence around Melilla from three to six metres along its entire 6km length.
Would-be immigrants hope for a
passage to EU through Morocco
Earlier this week, Spanish secretary of state for immigration, Consuelo Rumi, praised Morocco for its efforts to stem the flow of illegal immigrants, which she said had helped to reduce by a third the number of makeshift vessels intercepted last year off the Spanish coast.
But the disturbances at Melilla and Ceuta have revived debate with Morocco about the battle against illegal immigration.
The North African country is a transit point for sub-Saharan Africans hoping for access to Europe, but Morocco considers that EU states do too little to help it manage the problem.
Rabat would like to see Spain and the European Union conclude agreements which would see refused immigrants repatriated directly to their country of origin.
Morocco and Spain are also likely to insist that all countries have a responsibility in fighting illegal immigration at its source: a lack of economic opportunities in many poor countries that can only be solved through development.
The European Commission lamented the "tragic" deadly unrest on the Spain-Morocco border, but said it underlines the need for the EU to strengthen legal immigration channels.
"This tragedy, once again, bears witness to the urgent need for a genuine and effective management of migration issues"
EU justice and home affairs commissioner
"This tragedy, once again, bears witness to the urgent need for a genuine and effective management of migration issues," said EU justice and home affairs commissioner Franco Frattini.
He said the EU's strategy should be "hinged on a clear
consolidation of legal immigration channels and of the situation of legal immigrants, as well as an effective asylum system."