WASHINGTON—The federal budget deficit narrowed through the first 10 months of the year as the government collected more in taxes, a Treasury Department report showed Friday.

The deficit for October through July, the first 10 months of the fiscal year, totaled $973.84 billion, compared with a $1.100 trillion shortfall during the same period a year earlier, the Treasury said in its monthly report.

For fiscal 2012 so far, the government has spent $2.983 trillion, down slightly from $2.993 trillion a year earlier. The government's fiscal year begins Oct. 1.

The government has collected $2.009 trillion in taxes so far this fiscal year, up 6% from $1.893 trillion this time last year.

Treasury officials adjust the data to accommodate shifts in timing and to recalculate education programs and payments from the Troubled Asset Relief Program. The year-to-date deficit would be about $1.026 trillion in the 2012 fiscal year, compared with $1.185 trillion under the same basis a year earlier, the Treasury Department said.