WASHINGTON — President Trump agreed on Friday to reopen the federal government for three weeks while negotiations continued over how to secure the nation’s southwestern border, backing down after a monthlong standoff failed to force Democrats to give him billions of dollars for his long-promised wall.

The president’s concession paved the way for the House and the Senate to both pass a stopgap spending bill by voice vote. Mr. Trump signed it on Friday night, restoring normal operations at a series of federal agencies until Feb. 15 and opening the way to paying the 800,000 federal workers who have been furloughed or forced to work without pay for 35 days.

The plan includes none of the money for the wall that Mr. Trump had demanded and was essentially the same approach that he rejected at the end of December and that Democrats have advocated since, meaning he won nothing concrete during the impasse.

Mr. Trump presented the agreement with congressional leaders as a victory anyway, and indicated in a speech in the Rose Garden that his cease-fire may only be temporary: If Republicans and Democrats cannot reach agreement on wall money by the February deadline, he said that he was ready to renew the confrontation or declare a national emergency to bypass Congress altogether.