Updated 11am

Hundreds of migrants pulled from the Mediterranean by a rescue ship arrived at the Spanish port of Valencia on Sunday, ending a gruelling nine-day voyage but leaving wide open a fierce debate in Europe over how to handle immigration.

Spain swooped to help the group of mainly sub-Saharan Africans on board the Aquarius last week, offering the charity-run ship a berth 700 nautical miles away after Italy and Malta refused to let it dock.

The first migrants to arrive came on an Italian coast guard ship, which took aboard 274 of the Aquarius's passengers to make the journey safer. They arrived soon after dawn in the eastern Spanish port, where a staff of 2,320, including volunteers, translators and health officials, awaited.

Officials in white protective suits and masks greeted the migrants as they debarked and took them to a tent where police started identifying them and processing their information.

The Aquarius itself is due to dock once all the migrants are off the Italian vessel. Shouts and singing erupted on the ship as the 106 migrants on board saw Valencia on the horizon, Spanish journalist Gabriela Sanchez tweeted. Sanchez was travelling on another rescue group's boat alongside it.

The ship's predicament gave Italy's new government the chance to assert its anti-immigrant credentials, and Spanish Prime Minister Pedro Sanchez, in office for just over a week, took the opportunity to underline a more liberal stance.

But the plight of the Aquarius has highlighted the European Union's failure to agree on how to manage huge numbers of people fleeing poverty and conflict.

"People are coming to Europe seeking European values of solidarity and support," Red Cross Secretary General Elhadj As Sy told a news conference in Valencia on Saturday.

"Anything less than that is a betrayal (of) Europe itself."

Doctors Without Borders (MSF) which runs the Aquarius with Franco-German charity SOS Mediterranee, tweeted a photo of one of its team telling the people on board what they could expect.

"People are calm and pleased to be arriving in Spain," the group said.

READ: Italy tells Holland it should recall NGO migrant rescue ships

Upon arrival, the seven pregnant women on board the boats are to be immediately taken for check-ups, and everyone on board, including 123 minors, will receive psychological help, Spanish Red Cross officials said.

SOS Mediterranee's Julie Melichar reports from aboard the Aquarius. Audio: SOS Mediterranee (.mp3 file)

Anti-migrant feeling has surged in Italy, where more than 600,000 people have arrived on its shores over the past five years, helping to propel the nationalist League into a coalition government.

Far fewer come to Spain, but the numbers are rising fast.

Most Spaniards support the idea of welcoming and helping to integrate refugees, pollsters say, allowing Sanchez, a socialist, to offer migrant-friendly policies to voters who feel previous governments did not do enough.

France, which chided Italy for turning away the Aquarius, has offered to take in any passengers who qualify for asylum and want to go there.

The final boat in the convoy is due around 1000 GMT.

'I know you're very tired, but just be patient for a while longer': asylum seekers aboard the vessel are briefed. Video: SOS Mediterranee