The House-Senate compromise was reached by Democratic negotiators on a $42.8 billion homeland security appropriations bill.
The move sets up a clash with Republicans and a potentially difficult vote for dozens of House Democrats, who only last week voted in favor of a GOP plan to block any detainee transfers into the U.S. That vote came on a nonbinding motion, but Wednesday's compromise would carry the force of law for the rest of the budget year that began Oct. 1.
Obama's order to close Guantanamo by mid-January has vexed his Democratic allies on Capitol Hill, who complain that it was dropped on them without a plan to carry it out.
Republicans have been enthusiastic in their opposition to the plan and clearly feel that public opinion and the politics of Guantanamo are working in their favor. However, prominent members of the party, including last fall's presidential nominee, Sen. John McCain of Arizona, want to see the facility closed as well.
Supporters of closing Guantanamo say the facility and the lengthy detention of suspects who may have been held indefinitely without trial have hurt the United States' reputation across the globe. And they said fears of bringing the detainees to the U.S. are exaggerated.
Supporters of prosecuting Guantanamo detainees in the U.S. say existing federal prisons are more than adequate to safely hold them.
Republicans counter that Guantanamo is an ideal place to hold and prosecute the 223 detainees that remain there. Dozens of those have been approved for release, but U.S. officials fear they will be mistreated or killed if sent to their native countries, and they have yet to be accepted by other countries.
Administration officials say that the deadline for closing Guantanamo may slip anyway because of difficulties in completing the lengthy review of detainee files and resolving other tough questions.