WASHINGTON – 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 figure benefited from an estimated $9 billion in extra revenue from higher Social Security taxes. That helped lower 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 federal fiscal year began Oct. 1.

For the entire year, the Congressional Budget Office, or CBO, is forecasting that 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 last year of George W. Bush’s presidency.

The deficit is the amount the government must borrow when its expenses exceed its revenues. 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, 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 U.S. 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 what’s expected to be a smaller deficit for the year is higher taxes for some Americans. 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 cut of 2 percentage points 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 CBO is projecting even smaller annual deficits of $616 billion in 2014 and $459 billion in 2015. But as more baby boomers retire and claim benefits from 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 the president 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 such as 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, which began in the aftermath of the financial meltdown, has coincided with four straight $1 trillion-plus deficits.

The gaps reached a record $1.41 trillion in fiscal 2009, which began nearly four months before Obama took office. That deficit was due largely to the worst recession since the Great Depression. The budget gaps in 2010 and 2011 were slightly lower than the 2009 deficit.

Bush 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.