It marked the fourth straight year that deficits exceeded $1 trillion.
The deficit was down 16% from fiscal 2011 in dollar terms. And as a share of the economy it fell to 7%, down from 8.7% of gross domestic product in 2011. The fiscal year ended Sept. 30.
The decline is due to higher receipts and lower outlays.
Tax revenue was $2.45 trillion, accounting for 15.7% of GDP, slightly higher than in 2011 but well below the 18.3% historical average.
Revenue was boosted by the expiration of various tax provisions and a stronger economy, Treasury said in a joint statement with the White House budget office.
As is typical, individual income taxes accounted for the lion's share of total revenue -- $1.132 trillion.
Receipts from social insurance, including payroll taxes, totaled $845 billion.
Corporate receipts came in a distant third, at $242 billion, but grew strongly.
Spending, meanwhile, totaled $3.54 trillion, or 22.7% of GDP. That's below the 24.1% recorded in 2011 but still above the historical average of 20.7%.
Treasury attributed the drop to the expiration or phase down of stimulus measures, a stronger economy and the draw down of war efforts in Iraq and Afghanistan. Spending on the Department of Defense, unemployment insurance and Medicaid fell the most.
0The federal government spent $359 billion to pay interest on the country's debt. That includes interest paid both to investors who bought U.S. bonds and to government trust funds.
Treasury's numbers are largely in line with the 2012 spending, revenue and deficit estimates published last week by the Congressional Budget Office.
Deficits and debt have become a heated political issue and never more so than in the race for the White House. Not surprisingly, President Obama, the Democratic nominee, and Mitt Romney, his GOP challenger, have laid out very different routes to curbing deficits over the next decade.
|Stocks erase gains as Bernanke rally fades|
|Bernanke warns against hitting the brakes too soon|
|Memorial Day travel to dip this year|
|Vatican moves to clean up finances|
|'Grandparent scams' steal thousands from seniors|
|Overnight Avg Rate||Latest||Change||Last Week|
|30 yr fixed||3.65%||3.65%|
|15 yr fixed||2.80%||2.78%|
|30 yr refi||3.64%||3.63%|
|15 yr refi||2.79%||2.78%|
Today's featured rates:
|Latest Report||Next Update|
|Home prices||May 28|
|Consumer confidence||May 28|
|Manufacturing (ISM)||June 3|
|Inflation (CPI)||June 18|