The International Court of Justice (ICJ) said Israel must act "without delay" to allow the "provision... of urgently needed basic services and humanitarian assistance".
This follows warnings that famine could hit Gaza within weeks.
Israel has called allegations it is blocking aid "wholly unfounded".
It has also denied allegations of genocide lodged at the ICJ by South Africa and has blamed the UN for problems with the distribution of aid.
The latest ruling by the court in The Hague comes after South Africa asked it to bolster an order issued to Israel in January to take all measures to prevent genocidal acts in Gaza.
Although orders issued by the ICJ are legally binding, the court lacks the power to enforce them.
Last week, a report by the Integrated Food Security Phase Classification Global Initiative, which is run by the World Food Programme and others, warned that a "catastrophic" situation was developing.
It said that all of the 2.2 million people in Gaza were "facing high levels of acute food insecurity" and that famine was projected to hit the north of the territory before the end of May.
In its ruling, the ICJ said Gaza was "no longer facing only a risk of famine" but "famine is setting in" and that, according to UN observers, 31 people, including 27 children, had already died of malnutrition and dehydration.
It also noted comments by Volker Türk, the UN's high commissioner for human rights, who said last week that the "situation of hunger, starvation and famine" was "a result of Israel's extensive restrictions on the entry and distribution of humanitarian aid and commercial goods, displacement of most of the population, as well as the destruction of crucial civilian infrastructure".
The court said Israel must "take all necessary and effective measures to ensure, without delay, in full co-operation with the United Nations, the unhindered provision at scale... of urgently needed basic services and humanitarian assistance".
The aid most needed included food, water, electricity, fuel, shelter, and clothing as well as hygiene products and medical supplies, it said.
The ruling also said Israel must ensure "its military does not commit acts which constitute a violation of any of the rights of the Palestinians in Gaza" under the Genocide Convention.
Recent months have seen long queues of aid trucks repeatedly forming as they wait to enter Gaza from Egypt, and accusations levelled at Israel that it is subjecting the deliveries to complex and arbitrary checks.
In a filing last week, Israel asked the ICJ not to issue the latest order, saying South Africa's allegations were "wholly unfounded in fact and law" and "morally repugnant".
It has also dismissed the broader case being brought against it under the Genocide Convention as "baseless".
Israel has further said that Hamas takes much of the aid that enters Gaza and accused the UN of failing to distribute what is left to the civilian population.
The current conflict began after the 7 October attack, which saw Hamas-led gunmen storm across the border into Israel, killing around 1,200 people and taking more than 250 others hostage.
Of those taken, about 130 remain unaccounted for, at least 34 of whom are presumed dead.
Gaza's Hamas-run health ministry says Israel's retaliatory campaign has killed at least 32,552 people. Earlier this month, US Defense Secretary Lloyd Austin said that, of those killed, more than 25,000 were women and children.
bbc