WASHINGTON -- Congress gave final approval Thursday to a $1-trillion spending bill, but not without a last-minute standoff in the Senate by tea party Republicans who opposed the measure.

Conservative Sen. Ted Cruz (R-Texas) kept senators in suspense throughout the afternoon as he considered his options for blocking the bipartisan measure, which was overwhelmingly approved Tuesday by the House.

Eventually, the tea party opponents lost their fight and the measure was approved on a lopsided vote, 72-26. Seventeen Republicans voted in favor and 26 opposed. All Democrats and independents voted in favor.

President Obama is expected to quickly sign the bill into law before Saturday’s midnight deadline when funding for federal operations runs out.

Sen. Barbara A. Mikulski (D-Md.), chairwoman of the Appropriations Committee, said the bipartisan accord showed that Congress can work.

“We can avoid political dramas with cliffhangers and ‘fiscal cliffs,’” said Mikulski, who crafted the bill with her Republican counterpart in the House. “We’re a little late, but we have gotten the job done.”

The measure funds operations of government for the remainder of the fiscal year ending Sept. 30, removing the threat of federal employee furloughs and another shutdown of services like the one that occurred in October.

Reached late last year, the accord reverses some of the steep sequester cuts that were scheduled to take place this year -- boosting funds for the military, as Republicans sought, and for domestic safety-net programs prized by Democrats.

The troops will see a 1% pay raise and federal workers will get their first cost-of-living adjustment, also 1%, in four years.

Tea party opponents who wanted to preserve the sequester reductions were edged out by lawmakers from both parties who had called a truce in the fiscal fight.

Cruz, whose efforts to end Obamacare contributed to last year’s 16-day federal shutdown, tried unsuccessfully Thursday to attach an amendment that would have defunded the healthcare law. He said voters would decide the issue in the midterm election.

“This body faces a choice -- a choice between pragmatism and irresponsibility,” Cruz said. “Ultimately, in November, the American people will have a choice as well.”

Budget issues continue to divide Republicans. The party’s top leaders in the Senate, including Minority Leader Mitch McConnell of Kentucky, voted against the measure, as did the GOP’s potential presidential hopefuls, Sen. Marco Rubio (R-Fla.) and Sen. Rand Paul (R-Ky.).

lisa.mascaro@latimes.com

Twitter:@LisaMascaroinDC