The surplus was due in part to $66.3 billion in dividend payments from Fannie Mae and Freddie Mac. The mortgage giants were taken over by the government at the height of the 2008 financial crisis and are now repaying taxpayers for the support they received.
Through the first eight months of the budget year, the deficit has totaled $509.8 billion, according to the Treasury. That's $394.4 billion lower than the same period last year.
The Congressional Budget Office forecasts the annual deficit will be $670 billion when the budget year ends on Sept. 30. If correct, that would be well below last year's deficit of $1.09 trillion and the lowest since President Barack Obama took office. It would still be the fifth-largest deficit in U.S. history.
The Obama administration also estimates a lower annual deficit, although it projects a slightly higher figure of $759 billion.
Steady economic growth and higher tax rates have boosted the government's tax revenue this year. At the same time, government spending has barely increased. The dividend payments from Fannie and Freddie have also helped.
The federal deficit represents the annual difference between the government's spending and the tax revenues it takes in. Each deficit contributes to the national debt, currently $16.7 trillion.
The improving deficit picture has taken pressure off negotiations to raise the federal borrowing limit, although that battle is likely to resurface in the fall. Obama has remained at odds with Republicans over cutting benefit programs and imposing further tax increases.
The deficit reached a record $1.41 trillion in budget year 2009, which began four months before Obama took office. The Obama administration was forced to deal with a severe economic downturn that reduced revenues and boosted government spending in such areas as unemployment benefits and food stamps. The government also had to allocate billions of dollars to stabilize the financial system.
The budget gaps in the next three years were slightly lower as a gradually strengthening economy generated more tax revenue.
President George W. Bush also ran large deficits through most of his two terms in office after he won approval for broad tax cuts and launched wars in Afghanistan and Iraq.
The last time the government ran an annual surplus was in 2001.
MORE HBJ HEADLINES
Our new comment system is not supported in IE 7. Please upgrade your browser here.