Just 27 hours before a deadline that could have shut down the federal government at midnight Friday, Democrats and Republicans reached an agreement on a $1 trillion spending bill that will keep the lights on through the end of the fiscal year in September, 2012. They still have to work out the particulars of another sticking point — a separate measure extending a temporary payroll tax cut and jobless benefits. So what did both parties gain, and give up, to break the impasse? Here, a brief guide:

So, the parties settled their differences?
Not exactly. They still have to work out how to pay for the $120 billion payroll tax cut extension for 160 million workers, to keep it from expiring on Dec. 31. But they got close enough that the White House and Senate Democrats figured it was safe to detach the payroll-tax issue from the spending bill, which they were delaying in an attempt to force the GOP to negotiate. Now Congress can approve the spending bill, and focus on settling lingering differences over the payroll tax.

Who caved?
Both sides gave up a little on the spending measure. "The final bill strips out a Republican amendment to the Treasury budget to reinstate Bush-era restrictions on travel to Cuba" — something President Obama opposed, says David Rogers at Politico. But it also includes some GOP provisions that are hard for Democrats to swallow, such as one blocking new, greener standards for light bulbs.

Will extending the payroll tax be easy now?
Both sides say a deal is near, although anything can happen. Democrats have reportedly dropped their insistence on offsetting the cost with a surtax on people making more than $1 million a year, which was a dealbreaker for the GOP. But Republicans haven't budged on one provision Democrats have described as a poison pill — a controversial proposal to expedite the review of the Keystone XL oil pipeline.

What happens if they can't agree?
Both sides want to extend the payroll tax holiday. If they let it expire, the portion of Americans' paychecks withheld for Social Security and Medicare will rise 2 percent — from 4.2 percent to 6.2 percent. In such a scenario, someone making $50,000 would have to pay $1,000 more in payroll taxes. To avoid that, Congress is likely to pass a two-month extension if no long-term agreement is in sight. That way members will be able to head home for the holidays, and put off a final showdown until February.

Sources: CNN, NY Times, Politico, Washington Post