UPDATED: 11 p.m. EDT — Congress averted a government shutdown Wednesday, approving a stop-gap spending bill ahead of the start of the new fiscal year Saturday.

The measure includes funds to battle the Zika virus and came after Republicans and Democrats ended a lengthy battle over whether the federal government should help abate Flint, Michigan’s water contamination crisis.

The Senate approved the spending plan 72-26 Wednesday afternoon and the House followed suit late in the evening, voting 342-85.

UPDATE: 3:50 p.m. EDT — The Senate passed Wednesday, 77-21, a stopgap spending bill that would fund the government through Dec. 9. The bill now goes to the House for approval, which would need to come before a midnight Friday deadline to prevent the federal government from shutting down.

The spending bill previously failed to pass through the Senate Tuesday after Democrats objected to a lack of relief funds for the Flint drinking-water crisis, but House leaders brokered a deal that would address the funding in a separate measure. 

Original story:

Congress appeared to be one step closer to preventing a government shutdown Wednesday after Senate Democrats reportedly agreed to a deal brokered by House leaders that would resolve a hang-up centered on the the ongoing Flint, Michigan, drinking-water crisis. It's now expected the Senate will vote to pass a stopgap spending bill Wednesday afternoon that would fund the federal government through Dec. 9. 

The original spending bill put together by Senate Majority Leader Mitch McConnell, R-Kentucky, did not have provide any relief funding for the water crisis, which some Democratic lawmakers found unacceptable. A deal to pay for the Flint improvements in another bill might have resolved the issue.

"Under the deal, the House will vote Wednesday on an amendment to a pending water-projects bill that would authorize up to $170 million in infrastructure funds for communities such as Flint whose water systems are blighted by 'chemical, physical, or biological' contaminants," wrote the Washington Post

If the spending bill gets through the Senate in a vote Wednesday, it will have to be passed by the House before a midnight Friday deadline to avert a shutdown. It's believed that'll happen, with, of course, very little time to spare.

House Speaker Paul D. Ryan said the funding deal would "help unlock" the spending bill while speaking at the Economic Club of Washington Wednesday. "We should be able to move this through, I believe," Ryan said.

The spending bill failed in a vote Tuesday in the Senate, 55-45, after the vast majority of Democrats and 13 Republicans voted against it. The bill, which needed 60 votes to pass, included $500 million for flood relief in Louisiana and $1.1 billion to fight the Zika virus, but nothing for the water crisis. Democrats accused Republicans of not caring about the people in Flint, while the GOP countered that the rejection was politically motivated. GOP lawmakers said the Flint crisis was a state issue that didn't mandate federal help and that relief funding was already addressed in the separate water projects measure.  

The House amendment to the pending water-projects bill would later need to be reconciled with an existing Senate version with $220 million in funding. Those compromises would come after the Nov. 8 elections. The Senate passed its water measure on Sept. 15. 

Flint's water was contaminated with lead after it switched to using water from the Flint River in 2014 and pipes weren't protected from corrosion. Protective coatings from old pipes wore down and residents were left drinking toxic water. 

The funding would send aid to Flint and improve infrastructure to ensure water in the town of about 100,000 people is safe.