Spain has become the new main entry point for asylum-seekers fleeing Africa, an influx that European Union officials fear could exacerbate political tensions across the region over migration.

Around 19,000 asylum-seekers arrived in Spain in the first five months of this year, almost as many as arrived there in all of 2017, a record year, and eclipsing for the first time the numbers flowing through north Africa to Italy.

The surge has intensified in recent weeks as Italy's new government shut its ports to most asylum-seekers, rescue officials say.

With the EU struggling to contain dissent over migration policy, some officials in Brussels say they worry that Spain could become a new flashpoint, even as overall numbers of arrivals into Europe from Africa are in sharp decline.

"We must not let it blow up," an EU diplomat said.

He said the Morocco-Spain route had been kept under control for years. "It's not dramatic for now, but we are keeping an eye on this one."

Spain's new socialist prime minister, Pedro Sanchez, has been welcoming, and accepted two boat-loads of asylum-seekers denied port entry by Italy even as the number of boats from Morocco also rose.

The asylum-seekers are arriving in mostly inflatable boats each week, often without enough fuel for the crossing, straining Spain's coastguard. Madrid is training more lifeguards to deal with the rising numbers, coastguard union officials say.

People-smugglers in Morocco use a rights activist to contact the coastguard, advising it when boats set off for Spain, said coastguard official Oriol Estrada.

"The people traffickers know that the lifeguards are going to come for them," said Estrada, whose vessel has rescued around 1,200 people so far this year, more than 80 per cent of its total for 2017.

"They call to say that a certain boat has left such-and-such a coast at a certain time with however many people. They even give the names of those aboard."

A similar situation developed off Libya before Rome's recent crackdown, prompting Italy's ruling League party to accuse rescue ships of running a "taxi service".

Rescue officials working in the Strait of Gibraltar say more Asian migrants from countries like Pakistan and Sri Lanka are also crossing, another sign that smuggling networks are focusing more of their efforts on Spain.

Morocco is a destination in itself for those fleeing poverty and violence in sub-Saharan Africa, but it has become more of a stepping stone as people determined to reach Europe realise the Libya-Italy route may be worse than futile, refugees say.

"In Libya I saw migrants being fired at with live ammunition. A friend of mine was killed in front of my eyes by a Libyan teenager," said Guinea migrant Oumar Dialo, who tried and failed to reach Europe via Libya before ending up in Morocco.

"I would never recommend Libya even to my enemy."

More than 200 migrants on German rescue ship stuck at sea for six days after EU dispute

Speaking in Rabat, Dialo said he had tried to reach Spain by crossing a fence on the border of Morocco and Spain's north African enclave of Ceuta, but fell and broke his leg. He said he would try to reach Spain again when the time was right, to pursue his dream of becoming a professional roller-skater.

"I want to go to Europe because I want to help my family and become a professional roller," he said.

Morocco said it was boosting efforts to counter illegal immigration this summer, the busiest time for sea crossings.

"Morocco is committed to cooperating with its partners in the fight against illegal migration," government spokesperson Mustapha El Khalfi said.

EU officials in Brussels are struggling to agree on a joint response to migration to calm tensions in Italy and Germany. Leaders signalled their concerns over Spain last week when they reached a new accord on the issue, pledging to support Madrid and Morocco to stem the tide.

A Spanish government spokesman told Reuters the arrivals trend started more than a year ago and was not a result of any one factor. He added Spain is pushing for policy in Europe to be harmonised, however.

There are early signs that Sanchez might feel political pressure to toughen his approach if the influx continues to pick up speed.

Fernando Maura, foreign policy spokesman for the centre-right opposition Ciudadanos party, said the prime minister's current approach risked creating a "pull factor".

"When you send out a signal of this kind, it could well be received by those who want to come to Europe," he said.