Rome (CNN) Spain announced Monday that it would allow a ship carrying hundreds of migrants to dock in Valencia after Italy's new populist government turned the boat away in a move described by rescuers as unprecedented.

The Aquarius, which is carrying more than 600 migrants who were pulled out of the sea by rescuers over the weekend, was left stranded in the Mediterranean after Matteo Salvini, Italy's hardline interior minister and leader of the anti-immigration League party, refused to allow it to dock on Sunday.

More than 120 unaccompanied minors and seven pregnant women are on board the ship. By Monday, supplies were beginning to run low and a number of people were in need of medical treatment, including 15 with serious chemical burns and several others suffering from hypothermia, according to Doctors Without Borders (MSF), which operates the rescue ship Aquarius alongside SOS Méditerranée

MSF Spain said that while it appreciated the gesture from the Spanish government, it would be unsafe for the boat, which was over capacity and carrying people who needed medical attention, to make the three day trip to Valencia.

The boat has not received formal instructions from Italy or Spain to set sail to Valencia, a roughly 800-mile journey. "We are staying put until we are told where to go. We have no food or water to make it to Spain anyway," an MSF spokesperson said.

The Maltese government, which had also refused to let the Aquarius dock, delivered noodles, biscuits and bottles of drinking water to replenish the boat.

Spanish Prime Minister Pedro Sanchez announced Monday afternoon that the ship and its passengers would be welcome in Valencia, in an effort to prevent a humanitarian disaster from unfolding.

"It is our obligation to help avoid a humanitarian catastrophe and offer 'a safe harbor' to these people, thus complying with obligations of international law," he said in a statement.

The news was met with glee by Salvini, who took to social media within minutes to celebrate. "VICTORY! 629 migrants on board of Aquarius ship, Spain-bound, our first goal has been reached!" he wrote on Facebook. Salvini had called on Italy to "close the ports" and pledged Sunday to "STOP the filthy business of illegal immigration."

A rescue worker helps a young child on board the Aquarius.

Italian Prime Minister Giuseppe Conte also welcomed Spain's announcement, describing it as an "important turning point" in a Facebook post and adding that "Italy's requests begin to be heard."

The move comes as the number of migrants arriving on Spanish shores continues to grow. Migrant arrivals to Spain have increased by 50% so far in 2018 compared to last year, while Italy has seen around a 75% decline, according to the International Organization for Migrants (IOM). In the first week of June alone, 561 migrants arrived in Spain by sea.

Asked about the Italian move, UN Secretary General Antonio Guterres said at a briefing on Monday that he is concerned that the "space for refugee protection in Europe might be shrinking."

"My strong appeal is that, recognizing that countries have the right to manage their borders and have the right to define their own migration policies, countries should do it in a protection sensitive way and countries should do it in full respect for international refugee law."

UN High Commissioner for Human Rights Zeid Ra'ad Al Hussein praised Sanchez, saying that his decision to accept the ship was "courageous and welcome." The European Union and the UN refugee agency had called earlier for a quick resolution to the situation.

Anxiety grows aboard the Aquarius

From Saturday night into Sunday morning, the Aquarius took on 629 people in six separate operations, MSF and SOS said on Twitter. The boat has been stranded between Malta and the Italian island of Sicily since Sunday, when the Italian Coast Guard told Aquarius to hold its current position, according to MSF

Speaking to Spanish public radio broadcaster RNE Monday morning, Aloys Vimard, project coordinator on the Aquarius, said that on-board food supplies would last only one more day.

Nicola Stalla, search-and-rescue coordinator on the ship, told CNN that the scenario was unprecedented.

"We have never been in a situation before where we have been denied a right to a port of safety," he said Monday via a WhatsApp message. "We are nonetheless prepared to take care of the rescued people until we are."

A picture taken on June 9 shows the Aquarius during an operation to rescue migrants.

Anxiety was growing among the passengers on Monday afternoon, who were asking when they will reach shore, according to Anelise Borges, a Euronews and NBC journalist currently on board Aquarius.

"There's a certain tension in the air," she told CNN. "Everyone is extremely hot and very tired."

Many were also worried that they could be returned to Libya. "The fear is so present, so palpable," Borges said.

In footage posted to Twitter by Borges, women were sitting and lying on the floor in an enclosed area below deck, one fanning another to combat the heat.

There are no showers or sinks for migrants on the Aquarius, and rescue workers use a disinfectant spray on people's hands before they eat. Drinking water supplies are unlimited as the ship has its own water purification system, but the passengers were surviving mostly on energy biscuits, prepackaged warm rice, tea and bread.

Women and children sleep below deck, watched over by a midwife, while the men sleep on the open deck, covered only with tarpaulin.

Over 600 migrants on board the Aquarius remain in limbo.

More rescue ships on the way

Tensions in the Mediterranean are likely to rise as more rescue ships head for the Italian coast. According to Flavio di Giacomo, spokesman for the IOM, an additional 790 migrants were rescued Sunday by the Italian Coast Guard.

"I don't think the Italian government can deny a port of safety to the Italian Coast Guard, but they can to a foreign-flagged ship like the Aquarius," he told CNN on Monday. The Aquarius flies the flag of Gibraltar.

An Italian Coast Guard boat carrying over 900 migrants will dock in Catania on Tuesday, guard spokesman Cosimo Nicastro told CNN. They were rescued by the guard and the Italian Navy off the coast of Libya, he said. The boat is carrying 937 rescued migrants and two people who died, Nicastro said.

Salvini also signaled his intention Monday to prevent a second foreign-flagged search-and-rescue vessel, Sea Watch 3, operated by a group of German volunteers and currently positioned off the coast of Libya, from docking.

Speaking to reporters later in the day, Salvini said that the government "will have the same attitude towards other NGO ships" as towards Aquarius.

The Aquarius conducts a rescue over the weekend.

During the recent federal election campaign that led to Italy's new government -- a coalition between the anti-immigrant League and anti-establishment Five Star Movement -- Salvini promoted his party with an "Italians first" slogan and pledged to deport half a million migrants.

In August 2016, he called for "mass ethnic cleansing" in Italy, "street by street, neighborhood by neighborhood, with strong manners if we need to," according to Italian news agency ANSA.

Salvini's rhetoric has softened slightly since he took office, but on a visit to Sicily last week, he declared that Italy "cannot be Europe's refugee camp."

'A minister without heart'

On Sunday, several Italian mayors defied Salvini and suggested they would be prepared to welcome the Aquarius into their port.

Leoluca Orlando, mayor of the Sicilian capital Palermo, said Sunday that his city "will always be ready to welcome ships, civilian or military, which are committed to rescuing lives in the Mediterranean," and accused Salvini of violating international law.

The mayors of Naples and Reggio Calabria -- two coastal cities in mainland Italy -- also said they would allow the ship to dock.

Italian Interior Minister Matteo Salvini at a campaign rally in Massa Carrara, Italy, in May.

There are also signs of dissent within the coalition. Filippo Nograin, the Five Star mayor of Livorno, a port town in Tuscany, said on Facebook that he would welcome the migrants. He later deleted the post, telling the Italian newspaper La Repubblica that he didn't want to "create problems" in the government.

Such offers are largely symbolic, as only the Maritime Rescue Coordination Center, an arm of the Italian Coast Guard, can authorize the docking of a foreign-flagged ship. However, such strong and public rejection of the government's immigration policy could put pressure on Prime Minister Conte and his coalition just a week into its term.

The Mediterranean remains the world's deadliest migration route, despite sharp falls in the number of people trying to reach Europe by boat. That drop is partly ascribed to a deal struck between Italy and Libya last year, in which the southern European country pledged to bolster Libya's coast guard so it could spot departing migrant boats and house migrants attempting to cross.

Correction: This story has been updated to correct the title of Spanish Prime Minister Pedro Sanchez.