The deal will also avoid a possible U.S. default as the deadline to raise the debt ceiling approaches. Conservative Sen. Ted Cruz, R-Texas, said he will not try to block the measure.
This agreement comes 16 days after the government shutdown began, with the U.S. poised to lose its ability to borrow more money to pay bills.
Senate Majority Leader Harry Reid said the agreement he worked out with Mitch McConnell was "historic," saying that "in the end, political adversaries put aside their differences."
"This is not a time for pointing fingers and blame. This is a time of reconciliation," Reid said. "I look forward to working with my colleagues on both sides of this great Capitol to pass this remarkable agreement that will protect the long term health of our economy and avert a default on our nation's debt, and allow us to set a foundation for economic expansion."
Now, the agreement will be up for approval within the Senate and then the House. Should it pass both, it will reach President Barack Obama's desk, potentially as early as Wednesday evening.
The deal is expected to be rushed through to make sure all U.S. financial obligations are fulfilled.
"As soon as possible is essentially the recommendation we have from here," said White House spokesman Jay Carney.
Both chambers will take measures to get the legislation through quickly, and the House could vote "as early as tonight" following the Senate vote. The only potential obstacle is Tea Party conservatives in a last-ditch effort to attack Obama's health care law.
Tea Party leader Cruz said he will not attempt a filibuster or do anything else to get in the way of the legislation's passing.
The bill would reopen the government and fund it until January 15. It also raises the debt limit until February 7 to avoid a potential default.
If this deal somehow fails to clear either the House or Senate, and the debt limit is not raised by Thursday, the Treasury will have exhausted its borrowing authority and will be relying on limited cash reserves to pay off the nation's debt.
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'
Beyonce flaunts bikini body, Blue Ivy in vacation pics