The House easily passed a $1.1 trillion government wide spending bill on Wednesday, awarding wins to both Democrats and Republicans while putting off until later this year fights over President Donald Trump's promised border wall with Mexico and massive military buildup.

The 309-118 vote sends the bill to the Senate in time for them to act to avert a government shutdown at midnight Friday. The White House has said Trump would sign the measure, which is the first major legislation to pass in Trump's short, turbulent presidency.

House Speaker Paul Ryan praised the measure as bipartisan, and said the biggest gain for conservatives came as Democrats dropped longstanding demands to match Pentagon increases with equal hikes for nondefense programmes.

“No longer will the needs of our military be held hostage by the demands for more domestic spending,” Ryan said. “In my mind, that is what's most important here.”

Democrats also backed the measure, which protects popular domestic programmes such as education, medical research and grants to state and local governments from cuts sought by Trump — while dropping a host of GOP agenda items found in earlier versions.

“It's imperative to note what this bill does not contain,” said Rep. Nita Lowey of New York, lead negotiator for Democrats. “Not one cent for President Trump's border wall and no poison pill riders that would have prevented so-called sanctuary cities from receiving federal grants, defunded Planned Parenthood, undermined the Affordable Care Act.”

The bill is the product of weeks of Capitol Hill negotiations in which top Democrats like House Minority Leader Nancy Pelosi successfully blocked Trump's most provocative proposals — especially the Mexico wall and cuts to popular domestic programmes like community development grants.

The White House won $15 billion in emergency funding to jump-start Trump's promise to rebuild the military and an extra $1.5 billion for border security — each short of Trump demands — leading the president on Tuesday to boast, “this is what winning looks like.”

The opinions of top party leaders were not shared by everyone in the rank and file, some of whom feel that GOP negotiators too easily gave up on conservative priorities, such as cutting funds for Planned Parenthood and punishing “sanctuary” cities that fail to cooperate with immigration authorities.

“I don't think it was negotiated very well, and I'll just leave it at that,” said Representative Jeff Duncan, Republican-South Carolina.

The long-overdue bill buys just five months of funding while Trump and his allies battle with congressional Democrats over spending cuts and funding for the wall, which Trump repeatedly promised during the campaign would be financed by Mexico. Mexican officials have rejected that notion.

Republicans were surprised by tweets from Trump on Tuesday that suggested he was initially unhappy with the measure and might provoke a government shutdown this fall in hopes of getting his way on the wall and other demands.

The measure is the product of a bipartisan culture among Congress' appropriators, with money for foreign aid, grants to state and local governments and protection for the Environmental Protection Agency from cuts sought by Tea Party Republicans. The measure provides $2 billion in disaster aid money, $407 million to combat Western wildfires, additional grants for transit projects and a $2 billion increase for medical research at the National Institutes of Health.

Donald Trump's first 100 days: in cartoons Show all 33 1 /33 Donald Trump's first 100 days: in cartoons Donald Trump's first 100 days: in cartoons Donald Trump's first 100 days in office were marred by a string of scandals, many of which caught the eye of the Independent's cartoonists Donald Trump's first 100 days: in cartoons Trump's first 100 days have seen him aggressively ramp up tensions with his nuclear rivals in North Korea Donald Trump's first 100 days: in cartoons Mr Trump has warned of a "major, major conflict" with the pariah nation lead by Kim Jong Un Donald Trump's first 100 days: in cartoons Mr Trump dropped the "mother of all bombs" on alleged ISIS-linked militants in Afghanistan, amid an escalation of US military intervention around the globe Donald Trump's first 100 days: in cartoons Mr Trump has been accused of falling short of the standards set by his predecessors in the Oval Office, including Franklin D Roosevelt Donald Trump's first 100 days: in cartoons The tycoon's ascension to the White House came at a time when the balance of power is shifting away from Western nations like those in the G7 group Donald Trump's first 100 days: in cartoons Western politicians, including the British Conservative party, have been accused of falling in line behind Mr Trump's proposals Donald Trump's first 100 days: in cartoons Brexit is seen to have weakened Britain, reducing still further any political will to resist American leadership Donald Trump's first 100 days: in cartoons Mr Trump's leadership has been marked by sudden and unexpected shifts in global policy Donald Trump's first 100 days: in cartoons Trump's controversial missile strike on Syria, which killed several citizens, was seen by some analysts as an attempt to distract from his policy elsewhere Donald Trump's first 100 days: in cartoons The President has also spent a large majority of his weekends golfing, rather than attending to matters of state Donald Trump's first 100 days: in cartoons Though free of gaffes, a visit from Chinese president Xi Jinping spotlighted trade tensions between the two states Donald Trump's first 100 days: in cartoons One major and unexpected setback came when Mr Trump's Healthcare Bill was struck down by members of his own party Donald Trump's first 100 days: in cartoons Mr Trump has been a figure of fun in the media, with his approval at record lows Donald Trump's first 100 days: in cartoons A string of revelations about Mr Trump's financial indiscretions did not mar his surge to the White House Donald Trump's first 100 days: in cartoons Outgoing President Barack Obama was accused of wiretapping Trump Tower by his successor in America's highest office Donald Trump's first 100 days: in cartoons The alleged involvement of Russian intelligence operatives in securing Mr Trump the presidency prompted harsh criticism Donald Trump's first 100 days: in cartoons The explosive resignation of Security Adviser Michael Flynn, who lied about his links to the Russian ambassador, was just one scandal to hit the President Donald Trump's first 100 days: in cartoons Many scandals, such as the accusation Barack Obama was implicated in phone-hacking, first broke on Mr Trump's Twitter feed Donald Trump's first 100 days: in cartoons Donald Trump's election provoked mass protests in the UK, with millions signing a petition to ban him from the country Donald Trump's first 100 days: in cartoons Donald Trump cited a non-existent terror attack in Sweden during a campaign rally Donald Trump's first 100 days: in cartoons Donald Trump stands accused of stoking regional tensions in Eastern Asia Donald Trump's first 100 days: in cartoons North Korea has launched a number of failed nuclear tests since Mr Trump took power Donald Trump's first 100 days: in cartoons Theresa May formally rejected the petition calling for Mr Trump to be banned from the UK Donald Trump's first 100 days: in cartoons When Mr Trump's initial so-called Muslim ban was struck down by a federal justice, the President mocked the 69-year-old as a "ridiculous", "so-called judge" Donald Trump's first 100 days: in cartoons A week after his inauguration, Theresa May met with Mr Trump at the White House Donald Trump's first 100 days: in cartoons Donald Trump's first days in office were marked by a hasty attempt to follow through on many of his campaign promises, including the so-called Muslim ban Donald Trump's first 100 days: in cartoons Donald Trump's decision to ban citizens of many majority-Muslim countries from the US sparked mass protests Donald Trump's first 100 days: in cartoons Revelations about Donald Trump's sexual improprieties were not enough to keep him from being elected President Donald Trump's first 100 days: in cartoons British PM Theresa May was criticised by many in the press for cosying up to the new President Donald Trump's first 100 days: in cartoons One of Mr Trump's top aides, Kelly Anne Conway, was mocked for describing mistruths as "alternative facts" Donald Trump's first 100 days: in cartoons British PM Theresa May was quick to demonstrate that her political aims did not hugely differ from Mr Trump's Donald Trump's first 100 days: in cartoons Donald Trump's inauguration, on 20 January 2017, sparked protests both at home and abroad

The White House, Senate Majority Leader Mitch McConnell, Republican-Kentucky, and Senator Joe Manchin, Democrat-West Virginia, won a $1.3 billion provision to preserve health benefits for more than 22,000 retired coal miners. Pelosi was the driving force behind an effort to give the cash-strapped government of Puerto Rico $295 million to ease its Medicaid burden.