By Kristina Peterson and Lindsay Wise

WASHINGTON -- The House Tuesday night passed a short-term spending bill keeping the government funded through Dec. 11, after Democrats reached a deal with the White House over farm aid and food assistance.

The bipartisan agreement between House Speaker Nancy Pelosi (D., Calif.) and Treasury Secretary Steven Mnuchin, reached just hours before the vote, is expected to smooth the bill's passage in the GOP-controlled Senate and avert a partial shutdown when the government's funding expires next Thursday.

The bill passed in a 359-57 vote in the House. The Senate is expected to vote on it this week, aides said.

The agreement between Mrs. Pelosi (D., Calif.) and Mr. Mnuchin would add to the spending bill $21 billion sought by the White House for the Commodity Credit Corp., or CCC, a Depression-era program designed to stabilize farm incomes that permits borrowing as much as $30 billion from the Treasury to finance its activities. The agreement prohibits any payments from going to fossil fuel refiners and importers, a concern of Democrats.

President Trump has tapped the CCC program to finance both trade relief and coronavirus-related aid for farmers, a second round of which he announced at a campaign rally in Wisconsin last week. But the program has traditionally been used to send out payments established under bipartisan farm bills, some of which the Agriculture Department had said could be subject to delays as soon as October.

Mrs. Pelosi and Mr. Mnuchin also agreed to add $8 billion in nutrition assistance, the speaker said. That includes a one-year extension of a program expiring at month's end that would provide funding to families of school-age children to buy groceries, replacing the free or reduced-price meals they would have received at school. They also expanded the program to include children at child-care centers affected by the pandemic.

"We have reached an agreement with Republicans...to add nearly $8 billion in desperately needed nutrition assistance for hungry schoolchildren and families," Mrs. Pelosi said in a statement. "We also increase accountability in the Commodity Credit Corporation, preventing funds for farmers from being misused for a Big Oil bailout."

Tuesday night's deal ended an intensifying partisan battle over the farm aid. Democrats and Republicans had diverged this week in their assessment of whether the CCC program would need to be shored up early. The program's annual replenishment typically takes place in November or December after the CCC submits financial forms and is audited, according to the Congressional Research Service.

The Agriculture Department said that Covid-19 relief payments pledged by the Trump administration had left the program with only about $2 billion, and that it would be forced to prioritize which farm-bill payments could be made starting in October. Republicans and some Democrats said that any delays in payments could be detrimental to farmers already under pressure from the coronavirus' effect on the agricultural economy.

"They've been expecting these payments for a year," Rep. Mike Conaway of Texas, the top Republican on the House Agriculture Committee, said Tuesday. "They get them every year in October, just like clockwork. This year should be no different."

Democrats said that the Agriculture Department chose to swiftly transfer Covid-19 relief funds out of CCC and into Agriculture Secretary Sonny Perdue's office even before beginning to take applications and without factoring in coming farm-bill payments. The Agriculture Department said it had disbursed previous Covid-19 relief payments from Mr. Perdue's office and had to handle the recently announced relief funds the same way, resulting in a drawdown of the CCC.

Sen. Debbie Stabenow of Michigan, the top Democrat on the Senate Agriculture Committee, said Monday that Congress had already provided the Agriculture Department enough funding for it to send out October payments, and that it would be reimbursed in November.

"If there are additional needs, the [agriculture] secretary has tremendous flexibility to transfer unspent funds to fully fund farm-bill programs," Ms. Stabenow said.

The Farm Bureau estimated last week that once early October payments have been sent, the CCC program could be exhausted by November.

Jesse Newman contributed to this article.

Write to Kristina Peterson at kristina.peterson@wsj.com and Lindsay Wise at lindsay.wise@wsj.com