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.
Candidates fall short on curbing debt
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.