The result was a slight improvement from the 2011 deficit of $1.3 trillion.

The bleak figures from the Congressional Budget Office, while expected, add fodder for the heated presidential campaign, in which Obama's handling of the economy and the budget is a main topic. Friday's release came as the government announced that the unemployment rate dropped to 7.8 percent last month, matching the rate when Obama took office.

The administration will release the official deficit numbers around mid-October, but they should line up closely with the CBO estimate, which showed that the government borrowed 31 cents for every dollar it spent.

The CBO estimate predicts a modest 3 percent increase over 2011 in both income tax and payroll tax receipts, reflecting the sluggish economic recovery. Corporate income tax receipts are way up — almost 34 percent — but most of that is a result of tax rules governing write-offs of business equipment. (Read More: America's Top States for Business 2012)

Spending fell across a broad array of categories, the CBO said, but not Social Security and Medicare. Social Security payments rose by 6 percent, while Medicare grew by 3 percent, slightly less than in prior years.

Lower war costs meant a 3 percent decline in defense outlays, however, and the cost of unemployment benefits dropped 24 percent because fewer people have been receiving benefits recently. Medicaid costs dropped as well, because the federal government stopped paying a higher share of the program's costs.

Obama inherited an economy in recession and a deficit in excess of $1 trillion. He promised to cut the deficit in half by the end of his first term, but deficits have instead remained at eye-popping levels, including a record $1.4 trillion deficit in 2009 and deficits of $1.3 trillion in each of the past two years. The 2012 deficit was 7 percent of the size of the economy, an unsustainably high level.

In Wednesday night's debate, Obama said he has a budget plan to shave $4 trillion from the deficit over the coming decade, but he counts $1 trillion from savings already accomplished in budget deals with Republicans last year and $848 billion from winding down wars in Iraq and Afghanistan.

Republican presidential nominee Mitt Romney promises to balance the budget within eight to 10 years, but hasn't illustrated how he would do so. His budget claims are suspect as well since he promises to cut the overall budget by about $500 billion in 2016 alone, while also promising to sharply boost military spending and restore more than $700 billion in Democratic cuts to Medicare over the coming decade. Romney has ruled out increasing taxes.