Around 110,000 members of the Communications Workers Union (CWU) were set to walk out from 19 October in what would have been the first national postal strike since Royal Mail was privatised in 2013.
Staff had voted overwhelmingly earlier this month in favour of industrial action in a long-running dispute over pensions, pay and jobs.
Union leaders claim they have been trying to find a solution to the impasse for 18 months.
But a High Court judge supported Royal Mail’s case that the CWU was breaking its contract by calling a strike before outside mediation, which began on 5 October, is completed.
The injunction, Royal Mail claims, is necessary to prevent hundreds of thousands of people across the UK being deliberately inconvenienced as well as the company suffering commercially.
In granting the order, Mr Justice Supperstone said: “I consider the strike call to be unlawful and the defendant is obliged to withdraw its strike call until the external mediation process has been exhausted.”
The disagreement centres on the closure of Royal Mail’s final salary pension scheme to new entrants, the terms of a replacement scheme, and also rows over pay and delivery office closures.
The CWU says its gripes with the company are all linked to the controversial privatisation – accusing bosses of cost cutting and asset stripping to satisfy shareholders.
CWU General Secretary Dave Ward warned the firm its legal victory was not the end of the matter.
He said: “The company are deluded if they believe their court room politics will resolve this dispute. Instead the company’s actions will have the complete opposite effect.
“Postal workers’ attitude towards the company will harden and it makes us more determined than ever to defend our members pensions, jobs, service and achieve our objectives.
“Unless the company significantly shifts its position on a range of issues and we can quickly conclude a good agreement for our members then strike action is inevitable.
That position was reinforced by a tweet from the union itself, which said: “Royal Mail won the injunction but we stand here with 90% yes vote and more strike action ready to come. Your move #RiseUp”.