House lawmakers on Thursday approved a budget and debt deal that President Trump had endorsed, although most Republicans voted against the package.

While not funding the government, the measure would stave off another government shutdown by permitting the Treasury to borrow freely to pay the government’s bills and solidify recent budget gains for military and domestic programs.

The measure would tackle two big items on Washington’s agenda: increasing the debt limit through 2021, thus averting a default on U.S. payments, and setting overall spending limits to prevent $125 billion in automatic spending cuts from hitting military and domestic programs, with 10 percent cuts beginning in January.

The measure passed with a 284-149 vote, with the overwhelming "yea" votes coming from Democrats. In all, 219 Democrats voted yes, 65 Republicans voted yea, 132 Republicans voted no, and 16 Democrats voted no.

Democrats rallied behind the legislation, while many House conservatives generally balked at the measure for not doing enough to reduce the deficit.

Still, President Trump tweeted after the vote: "I am pleased to announce the House has passed our budget deal 284-149. Great for our Military and our Vets. A big thank you!"

"We are pleased that our increase in non-defense budget actually exceeds the parity number on defense by $10 billion over the next two years," House Speaker Nancy Pelosi, D-Calif., who along with Treasury Secretary Steven Mnuchin was the main architect of the measure.

"And we're pleased to be able to say that we have secured an increase of more than $100 billion in the budget cap for domestic priorities since the President took office," she added.

“House Republicans should support the TWO YEAR BUDGET AGREEMENT which greatly helps our Military and our Vets,” Trump tweeted earlier Thursday. “I am totally with you!”

Other GOP lawmakers praised the bill as an imperfect but necessary result of Washington's divided balance of power.

DEFICITS ARE EXPLODING -- AND NEITHER PARTY SEEMS TO CARE

"The alternatives are very, very bad," said Rep. Kay Granger of Texas, the top Republican on the Appropriations Committee.

The House separately defeated an effort by Rep. Thomas Massie, R-Ky., to change the title of the legislation from "The Bipartisan Budget Act" to "The Kick the Can Down the Road Act," 384-47.

CLICK HERE TO GET THE FOX NEWS APP

The legislation is expected to be sent to the Senate for approval before it is sent to President Trump's desk. Senate Majority Leader Mitch McConnell, R-Ky., said the Senate will consider the plan next week.

Fox News’ Chad Pergram and The Associated Press contributed to this report.