Despite a strike ballot of 110,000 members which produced an 89.1% vote in favour on a 73.7% turnout, the postal-workers CWU had their 48-hour walkout from 19 October declared unlawful.
The vote was a test for the union after the introduction of the Trade Union Act, which requires strike ballots to have a 50% turnout.
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."
Shares in Royal Mail closed 0.7% higher
The CWU said reform workers' pensions means that its members will lose up to a third of their retirement entitlements and Royal Mail conceded pension scheme members would indeed build up smaller benefits in future.
CWU general secretary Dave Ward said: "The company are deluded if they believe their courtroom 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."
Royal Mail said the mediation process will take close to Christmas to be completed, and may be longer.