Move by new Spanish government comes after Italy and Malta refused to let humanitarian vessel dock at their ports.

Spain's new government has stepped up and offered to take in a rescue ship that is drifting in the Mediterranean sea with 629 refugees and migrants, including 123 unaccompanied minors, on board after Italy and Malta refused to let it dock.

Spain's Prime Minister Pedro Sanchez, a socialist who took office just over a week ago, gave instructions for the humanitarian vessel to be admitted to the eastern port of Valencia, his office said in a statement on Monday.

The Aquarius took the people, including seven pregnant women, from inflatable boats off the coast of Libya at the weekend.

It sailed north towards Italy, but Matteo Salvini, head of the far-right League party who became interior minister this month vowing to curb an influx of migrants from Africa, blocked it and said it should go to Malta, a fellow European Union member, instead.

"Saving lives at sea is a duty, but transforming Italy into an enormous refugee camp is not," Salvini wrote on Facebook on Monday.

Malta refused, saying it had nothing to do with the rescue mission, which was overseen by Italian coastguard.

Valencia is almost three days' voyage for the Aquarius, while Italy and Malta are just hours away.

Aloys Vimad, from Doctors without Borders, one of the group' co-operating the Aquarius, said there was enough food and water "to give to people for two to three days".

Commenting about heading to Spain, Vimad, who is on board the ship, told Euronews: "This is not what we wish, it's overcrowded ... people are weak, tired, exhausted."

Antoine Laurent, from SOS Mediterranee, which also co-operates the ship, echoed the same sentiment.

He said the charity acknowledged Spain's solidarity but stressed that heading there was not their decision.

"[Italy] is under command and they have to take that decision," he said.

"It's also technically not really easy for us to go to Spain, we will need at least two more days of sailing, which is not possible," he added. "We urge Italy to find a solution very soon close to our position."