The US Supreme Court has given President Donald Trump permission to use $2.5 billion (£2 billion) of Pentagon funds for a section of wall on the southern border.
The court ruled by five votes to four to block a ruling by a federal judge in California that barred the president from spending the money on the wall.
The wall, dividing the US and Mexico, was Mr Trump’s major campaign promise during the 2016 election.
It is fiercely opposed by Democrats.
The decision by the Supreme Court means that the money will be used for wall projects in California, Arizona and New Mexico.
The court in California had argued that Congress had not specifically authorised the funds to be used for constructing the wall.
In a tweet, Mr Trump described the ruling as a “big victory.”
Mr Trump declared an emergency earlier this year, saying he needed $6.7bn to build the wall as a matter of national security. However this figure is far short of the estimated $23bn cost of a barrier along the whole 2,000 miles (3,200km) of border.
Democrats claimed his decision exceeded his powers under the US Constitution.
About 20 states, along with groups including the American Civil Liberties Union (ACLU) have filed lawsuits to try and stop the president using the emergency declaration to bypass Congress.
Environmental groups have also campaigned against building the wall claiming that it could have a negative impact on wildlife.
In February, Congress approved $1.38bn for the construction of “primary pedestrian fencing” along the Rio Grande Valley in Texas – far less than Mr Trump had sought.
The House of Representatives is also taking legal action to stop the diversion of further funds for the wall project.