CHRISTIANSTED, V.I. — President Biden signed a $1.7 trillion spending bill into law on Thursday, averting a shutdown and keeping the government funded through September while adding to his legacy of expanding federal programs as president.
The signing was not a surprise; Mr. Biden had pushed Congress to reach a deal on funding the government ahead of a deadline at the end of this month, and he had cheered the bill when it passed the Senate and then the House.
But the setting for the bill signing was unusual. Instead of staging a ceremony in the White House, Mr. Biden wielded his pen on the island of St. Croix, where he is vacationing through the new year. White House officials received the more than 4,000-page bill from Congress late on Wednesday afternoon and sent it to the Virgin Islands on Thursday on a commercial flight.
The bill, which cleared Congress on Dec. 23, was the last major legislative accomplishment of the first two years of Mr. Biden’s tenure in the White House, when Democrats narrowly controlled both the House and the Senate.
It included significant spending increases for national defense and for domestic spending not related to the military, reflecting divergent partisan priorities in Washington. The bill put aside $858 billion in defense funds, which Republicans had pushed for, and more than $772 billion for the education, health and veterans programs Democrats have supported. That money included significant new aid to Ukraine to help in its fight against the Russian invasion.
Lawmakers tacked several disparate agenda items onto the bill, including more money for law enforcement across the country, a set of new rules meant to help Americans save more for retirement and an overhaul of the federal procedure for counting electoral votes in a presidential election — a response to former President Donald J. Trump’s efforts to disrupt the count of the 2020 election, which he lost, on Jan. 6, 2021.
The bill was the second sprawling government funding measure passed during the Biden administration. Because Republicans won control of the House in the midterm elections in November, it was also the final opportunity for congressional Democrats to shape the federal budget while in control of both chambers.
Mr. Biden signed the bill behind closed doors, on a day when he made no public appearances and took no questions. He said in a written statement that the measure advances “key priorities for our country and caps off a year of historic bipartisan progress for the American people.”
Emily Cochrane contributed reporting from Washington.