Congress on Friday passed a stopgap funding measure to keep the government funded through April despite strong opposition from coal-state Democrats.
The Senate passed the short-term funding bill 63 to 36. The bill will go to the president's desk for his signature.
The government would have partially shut down at midnight Friday had an agreement not been reached.
A group of Democrats led by West Virginia Sen. Joe Manchin threatened to stall the spending bill in the hopes of extending health care benefits for about 16,500 miners that are set to expire at the end of the year. The government funding bill will extend those benefits until the end of April, when government funding expires.
The coal-state senators said they will renew their fight to extend the health benefits beyond April when the new Congress begins in 2017.