The budget gaps in 2010 and 2011 were slightly lower than the 2009 deficit as a gradually strengthening economy generated more tax revenue. But the deficits still exceeded $1 trillion.
Obama is campaigning for a second term with a pledge to cut deficits by $4 trillion over the next decade. He says he would do so by ending the Bush-era income tax cuts for higher-income Americans and by restraining the growth of spending.
Romney has said he would cut spending growth to help narrow the budget gap. He would cap spending at 20 percent of the economy by 2016. Spending in 2012 accounted for about 23 percent of the economy.
The government borrowed about 31 cents of every dollar it spent in 2012. The string of $1 trillion-plus deficits has driven the national debt above $16 trillion. The magnitude of that figure has intensified debate in Congress over spending and taxes but little movement toward compromise.
Many fear the budget deadlock will send the economy over a "fiscal cliff" next year, when tax increases and deep spending cuts will take effect unless a budget deal is reached.
Obama wants to eliminate the income tax cuts for families that make more than $250,000.
Republicans in Congress and Romney have resisted. They argue that with the economy still weak, the government should not be raising anyone's taxes.
Congress may address the budget crisis during a lame-duck session of Congress after the November elections.