An administrative tribunal in Lazio has allowed the NGO rescue ship Open Arms to enter Italian waters, despite a decree by Italian Interior Minister Matteo Salvini banning such ships.
The tribunal on Wednesday afternoon said Mr Salvini's decree amounted to abuse of power and a breach of international law concerning rescue at sea.
The decision was welcomed by those on board.
"We are satisfied, not for us, but for the thousands of people who are dying in the Med. Their rights are our rights," Open Arms said.
The decision came as the vessel, with 159 people on board, battled rough seas off Lampedusa.
It is now heading for shelter off the Italian island, but it is unclear whether it will be allowed to berth.
Also seeking shelter in the central Mediterranean is the Ocean Viking, carrying 356 migrants picked up in four rescue operations close to Libya.
Its operators, SOS Mediterranee and Medicines Without Frontiers, said many of those on board are suffering seasickness.
"Remaining at sea while people suffer cannot be the solution. People should be disembarked in a place of safety as soon as possible."
SOS Mediterranee said an overwhelming majority of the migrants had experienced either arbitrary imprisonment, extortion, being forced to work in slavery-like conditions or torture. The group includes 103 children under the age of 18, only 11 of whom are accompanied.
Earlier on Wednesday Open Arms tweeted that the weather had turned the bad situation aboard into drama.
"Do European states really allow such a thing? What do you call this, if not a humanitarian emergency? Where are you? #unportosicurosubito."
Open Arms, operated by a Spanish NGO, is carrying 159 migrants. Most were rescued on August 1 off Libya while 39 were rescued in the Maltese rescue zone on Friday. Malta had offered to take those 39 but the operators said Malta should take all the migrants or none at all. Spain has also refused to allow the migrants in.
Se la situazione era già difficile a bordo #Openarms, la meteorologia la trasforma in drammatica. Davvero gli stati europei permettono una cosa simile? Come la chiamate questa, se non emergenza umanitaria? Dove siete? #unportosicurosubito pic.twitter.com/pOLtpbH6Pd— Open Arms IT (@openarms_it) August 14, 2019
Meanwhile, the migration crisis was also unfolding elsewhere. The International Organisation of Migration reported that some 100 migrants had been picked up from boats and taken back to Libya by the Libyan coastguard. It reiterated its view amid escalating clashes, Libya is not a safe port for disembarkation.
Further east, eight boats carrying migrants had arrived have arrived on the Greek Aegean Islands by mid-afternoon. They carried 262 people. Five of the boats arrived on Lesvos.
Franco-Irish girl's family mourn 'unbearable' loss, as autopsy conducted
Malta's industrial output growth joint highest of EU member states