The top UN court has ordered Pakistan to review the death penalty handed down to an Indian Navy officer convicted of spying.
Pakistan has violated international law by denying India consular access to Kulbhushan Jadhav, the International Court of Justice (ICJ) has ruled.
The rulings of the ICJ are binding but it has no power to enforce them.
Kulbhushan Jadhav was arrested in Pakistan in March 2016 and sentenced to death by a military court a year later.
The Hague-based ICJ ruled that Pakistan had failed to inform Mr Jadhav of his rights, and deprived the Indian government "of the right to communicate with and have access to [him], to visit him in detention and to arrange for his legal representation".
"A continued stay of execution constitutes an indispensible condition for the effective review and reconsideration of the conviction and sentence," it added.
However, the court did not order Pakistan to free Mr Jadhav.
An Indian official told AFP news agency that the ruling was "a complete victory", adding: "This opens up the possibility of consular access and a retrial in a civilian court."
Wednesday's verdict is likely to fuel tensions between the nuclear powers. India and Pakistan were on the brink of war in February over the disputed territory of Kashmir.
The neighbours have a long history of diplomatic spats and often accuse each other of sending spies into their territories.
The facts of the Jadhav case are intensely disputed by Pakistan and India, and now both sides seem to be claiming this ruling as a victory. India will now be allowed consular access to Jadhav, while Pakistan can point to the fact the judges declined to order Jadhav be freed.
It's not entirely clear what will happen next. The ICJ stated Pakistan could decide how best to conduct an "effective review" of Jadhav's conviction and sentence, but seemed to suggest a review by a civilian high court would be suitable.
This case is a huge deal in Pakistan, where it's seen as evidence that India is supporting militant separatist groups in places like Balochistan province.
Pakistani authorities want this allegation to receive the kind of prominence and international attention that is attached to more widely known claims that Pakistan supports anti-Indian jihadist groups.
What are the allegations?
The case of Kulbhushan Jadhav has been a thorny issue since his arrest three years ago.
Pakistan said it had detained him in the restive province of Balochistan, home to a separatist insurgency that it accuses India of backing. India said he was kidnapped in Iran, which borders the province, where he was doing business.
Shortly after his arrest, the Pakistani authorities released a video in which he was shown admitting involvement in spying.
India has always questioned the alleged confession, saying that it was extracted under duress.
In April 2017, he was convicted of espionage and terrorism and sentenced to death. India then filed a case with the ICJ.
India said that Pakistan had violated the Vienna Convention on Consular Relations by denying access to Mr Jadhav. Pakistan argued that he was not entitled to consular access because he is a spy who entered the country to create "unrest and instability".
The ICJ was set up in 1945 to rule on disputes between nations.
The last time India and Pakistan took a dispute to the court was in 1999 when Islamabad protested against India's downing of a Pakistani navy plane.
The court decided that it had no jurisdiction to rule in the dispute and closed the case.