WASHINGTON — The Senate gave final approval on Thursday to a two-year budget deal that would raise federal spending by hundreds of billions of dollars and allow the government to continue borrowing money, sending the measure to President Trump for his expected signature.

Barely half of the Republican majority joined almost all of the Democrats in voting for the measure, 67 to 28, after a deal largely negotiated by Speaker Nancy Pelosi and Treasury Secretary Steven Mnuchin stoked conservative dissatisfaction over Washington’s failure to cut government spending. Democrats pointed to large Republican tax cuts as the latest driver pushing the surging expansion of the federal debt and claimed victory for the increases in domestic spending.

The budget deficit through June of this fiscal year reached $746 billion, up from $607 billion at the same time last year, despite healthy economic growth. Yet the agreement now heading to Mr. Trump would raise military and domestic spending by $320 billion over existing statutory spending gaps for this fiscal year and next.

“Given the exigencies of a divided government, we knew any bipartisan agreement on funding levels would not appear perfect to either side,” Senator Mitch McConnell, Republican of Kentucky and the majority leader, said Wednesday in a floor speech.