Updated

The federal government reported a rare surplus for January and is on track to run its smallest annual budget deficit since President Obama took office.

The Treasury Department said Tuesday that the government took in a surplus of $2.9 billion in January. That's the first monthly surplus since April, a month that benefited from income tax payments.

January's budget benefited from an estimated $9 billion in extra revenue from higher Social Security taxes. That helped lowered the deficit through the first four months of the budget year to $290.4 billion -- nearly $60 billion lower than the same period a year ago.

The budget year began on Oct. 1.

For the entire year the Congressional Budget Office is forecasting the deficit will total $845 billion. If correct, that would be first time government hasn't run an annual deficit in excess of $1 trillion since 2008.

The deficit is the amount the government must borrow when its expenses exceed its revenue. Each month's deficit is volatile and can be affected by calendar quirks that shift government spending or revenue from one month to another.

The annual deficit is projected to be smaller this year because the government is collecting more revenue this year, mainly because of faster job growth and higher taxes.

At the same time, the government is spending less on some programs. That's in part because of spending cuts that were enacted under a 2011 agreement to raise the federal borrowing limit. Also, the improved economy has reduced demand for unemployment benefits and some other government programs.

Last year, the economy grew at a modest 2.2 percent and generated an average of about 180,000 jobs a month. Stronger job growth is forecast for this year -- an average of more than 200,000 a month, some economists say. More jobs mean more income, which generates more tax revenue for the government.

Another factor in a smaller expected deficit is higher taxes for some Americans this year. When Congress and the White House reached a deal in January to avert the fiscal cliff, they allowed taxes to rise on individuals earning at least $400,000 a year and couples earning $450,000. And the agreement allowed a 2 percentage point cut in the Social Security tax to expire, thereby raising taxes on nearly everyone who earns a paycheck. This year's higher Social Security tax is projected to raise about $10 billion more a month in revenue.

The additional revenue is likely to slow the deficit's growth for the rest of the budget year, which will end Sept. 30. The deficit will also likely shrink in April, when the government collects much of its income-tax revenue. Last year, the government reported a surplus of $59 billion for April. A stronger economy could make this year's April surplus even larger.

The Congressional Budget Office is projecting even smaller annual deficits of $616 billion in 2014 and $459 billion in 2015. But as more baby boomers retire and claim Medicare and Social Security, deficits would likely rise again. The implementation of the 2010 health care law would also widen deficits. The CBO forecasts that deficits could near $1 trillion again by 2023.

Republicans and President Obama agree on the need for a plan to contain the deficits. But they are at odds over the details. Republicans want to trim growth in Social Security and Medicare spending but oppose any further tax increases.

Obama has said he is willing to consider cuts in the growth of entitlement programs like Medicare and Social Security. But he argues that a balanced approach will require further tax increases on the highest earners.

The government has run annual deficits for more than a decade. Obama's presidency has coincided with four straight $1 trillion-plus deficits.

The gaps reached a record $1.41 trillion in budget year 2009, which began four months before Obama took office. That deficit was due largely to the worst recession since the Great Depression. Tax revenue plummeted. And the government spent more on stimulus programs.

The budget gaps in 2010 and 2011 were slightly lower than the 2009 deficit as a gradually strengthening economy generated more tax revenue.

President George W. Bush also ran annual 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.