The US Supreme Court has handed Donald Trump a reprieve by allowing his administration to redirect $2.5 billion earmarked for the Pentagon to help build his US-Mexico border wall.

The conservative-majority court overturned by a 5-4 vote a ruling by a federal judge in California that prevented Mr Trump from using the money on the wall as it had not been approved by Congress.

"Wow! Big VICTORY on the Wall. The United States Supreme Court overturns lower court injunction, allows Southern Border Wall to proceed. Big WIN for Border Security and the Rule of Law!" Mr Trump tweeted.

A brief order explaining the court's decision said the government "made a sufficient showing" that the groups challenging the decision did not have grounds to bring a lawsuit.

"The diversion of military funds for border wall construction will wall off and destroy communities, public lands, and waters," said Gloria Smith, an attorney for the Sierra Club, which sued to block the funds.