The Senate passed and President Trump signed a government spending bill Thursday that funds federal agencies through December 20, averting a government shutdown.

The measure, known as a continuing resolution, was approved by the Senate 74-20 hours before government funding runs out at midnight. Passed by the House on Tuesday with support from just 12 Republicans, the measure then headed to Mr. Trump's desk for his signature.

Mr. Trump signed the bill Thursday evening, a White House official said.

Get Breaking News Delivered to Your Inbox

The measure keeps the government funded at current levels and allocates $7.2 billion to fully fund the 2020 Census. It also funds a 3.1% pay raise for all members of the military, extends expiring health care programs and reauthorizes provisions of the Foreign Intelligence Surveillance Act set to expire December 15.

Federal agencies are currently funded through a stopgap spending bill passed by Congress at the end of September, making this most recent continuing resolution the second to take effect since the start of the fiscal year October 1.

The short-term measure sets up a government spending fight days before Christmas, as Republicans and Democrats remain at an impasse over money for Mr. Trump's wall along the U.S.-Mexico border. The president's push for wall funding has impeded Congress's ability to reach an agreement on 12 yearly spending bills.

A standoff over money for the border barrier led to a historic government shutdown that started in late 2018 and lasted 35 days, through the start of the new Democrat-led House.

Mr. Trump ultimately signed a stopgap measure reopening the government without receiving money for the wall, but declared a national emergency to bypass Congress and divert funds to pay for the barrier.

Kathryn Watson contributed to this report.