CIUDAD JUÁREZ, Mexico — Near dawn on Friday, the line of trucks waiting to cross the border from Mexico into the United States stretched for more than three miles and wasn’t moving.

Arturo Ornelas, a Mexican truck driver, was four places from the front, but his choice position had not come without sacrifice: He had joined the line at 8 a.m. Thursday and had spent the intervening 22 hours slouched in — or stretching his legs alongside — his truck, carrying a load of copper wire from a factory in Ciudad Juárez, Mexico, to a warehouse in neighboring El Paso.

But now his goal was finally, seemingly within reach, and he could see the twinkling lights of the American city through the nearby border fence, on the other side of the Puente Libre, or Free Bridge.

“So close,” he muttered, “yet so far.”

President Trump may have relented Thursday on his threat to close the southwest border of the United States in punishment for what he has said was Mexico’s failure to control illegal migration. But for a week now the border has, in effect, been partly closed because of American staffing shortages — costing businesses millions of dollars a day, according to industry officials, and causing painfully long delays for people and goods trying to legally cross the border.