Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A deal has been reached on a $1 trillion-plus bill to fund the government for the final five months of this fiscal year, an agreement that is likely to avert a government shutdown.

Congressional negotiators had been working through the weekend to hash out the last remaining complications in a bill to fund the government before the agreement was announced Sunday night.

After President Donald Trump backed down on funding for the construction of a border wall, some additional sticking points remained, including health benefits for coal miners, funding for Puerto Rico and an additional $30 billion for defense, delaying congressional negotiators and causing them to miss their deadline of last Friday. Congress passed and Trump signed into law a one-week extension to keep the government open and give negotiators more time.

The spending agreement must still be passed by Congtress and signed by President Donald Trump. Pool / Getty Images

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The newly reached deal includes an additional $15 billion in defense spending, less than what Trump asked for, but still $25 billion more than last year's spending. It also includes a permanent fix to fund coal miners' health care instead of a temporary extension.

Senate Democratic leader Chuck Schumer of New York called the deal "a good agreement for the American people" that "takes the threat of a government shutdown off the table."

"The bill ensures taxpayer dollars aren't used to fund an ineffective border wall, excludes poison pill riders and increases investments in programs that the middle-class relies on, like medical research, education and infrastructure," Schumer said Sunday night.

"Early on in this debate, Democrats clearly laid out our principles," he said. "At the end of the day, this is an agreement that reflects those principles."

Democrats stressed that there is no money not only for a border wall, but also none for a deportation force, and they said there would be no cut in funding for so-called sanctuary cities.

And instead of $3 billion for border security, which was requested by the Trump administration, the bill includes just half of that — $1.5 billion. It also includes $295 million for Puerto Rico's Medicaid program.

A big moment in these negotiations was when Trump backed down from two of his demands last week on money for a border wall and withholding subsidies to help lower-income people buy health insurance under the Affordable Care Act.

The House and the Senate still have to pass the bill before it can be signed by the president.

Democratic votes will be needed to pass the measure even though Republicans control both the White House and Congress. The minority party has been actively involved in the talks.

The House and Senate have until midnight Friday to pass the measure to avert a government shutdown. It's unclear how much support the measure will receive from GOP conservatives and how warmly it will be received by the White House.