"In its review of this case, the court cannot and does not consider whether the underlying decisions to construct border barriers are politically wise or prudent," Curiel wrote.
The lawsuit was the first major legal challenge to the wall under Trump and the latest legal challenge to fail over the years.
The Center for Biological Diversity, which sued along with the state of California and other advocacy groups, said it would appeal.
"They're giving unprecedented, sweeping power to an unelected agency chief to ignore dozens of laws and crash through hundreds of miles of spectacular borderlands," attorney Brian Segee said, referring to the head of Homeland Security. "This is unconstitutional and shouldn't be allowed to stand."
California Attorney General Xavier Becerra said, "We will evaluate all of our options and are prepared to do what is necessary to protect our people, our values, and our economy from federal overreach."
U.S. Justice Department spokesman Devin O'Malley welcomed the decision, saying Congress granted authority to build a wall without delay and that the administration is pleased it can continue "this important work vital to our nation's interests."
Homeland Security spokesman Tyler Houlton added, "Simply put, walls work."
The decision came days after construction began on a 30-foot (9.1-meter) high barrier in Calexico, California, the administration's first wall project outside of eight prototypes in San Diego that were completed in October.
The administration has issued three waivers since August, two to build in parts of California and one in part of New Mexico. President George W. Bush's administration issued the previous five waivers, allowing the government to quickly extend barriers to about one-third of the border.
The Center for Biological Diversity was first to sue, with three other groups — the Sierra Club, Defenders of Wildlife and Animal Legal Defense Fund — later filing a lawsuit. Becerra, a Democrat, was close behind, and Curiel consolidated all three cases.
The Center for Biological Diversity said in its lawsuit that the waiver authority cannot be interpreted to last forever. California argued that it expired in 2008, when Homeland Security satisfied congressional requirements at the time on how much wall to build.
Curiel wrote that the law certainly "is not a model of legislative precision." He said both sides made plausible arguments.
The judge declined to second-guess the administration's findings that waivers were issued in areas of "high illegal entry," a requirement set by Congress. The advocates argued that dramatic declines in border arrests undermined those findings.
During 2½ hours of arguments this month, the judge peppered both sides with questions about the law's meaning. He showed strong interest in a requirement tacked on in late 2007 for Homeland Security to consult other federal agencies, state and local governments, Indian tribes and property owners to minimize the impact of construction, which challengers said the administration failed to do.
Curiel said in his ruling that the law's lack of specifics prevented him from concluding that the administration failed to properly consult others.
Trump is seeking $18 billion to extend the wall as the White House and Congress are at an impasse. Earlier this month, the Senate rejected an administration-backed plan to link funding and sharp cuts to legal immigration to allowing young immigrants to stay in the country after they were temporarily shielded from deportation under an Obama-era program, Deferred Action for Childhood Arrivals.
The wall prototypes in San Diego that were built to guide future designs and the wall replacement in Calexico were previously funded.
Curiel was pilloried by Trump over the Trump University lawsuits. The then-presumptive Republican presidential nominee called him a "hater" of Trump who should be ashamed, calling attention to the judge's Mexican ancestry and Trump's support for a border wall.