WASHINGTON — The U.S. government ran a much smaller deficit through the first two months of the budget year than the same period last year, signaling further improvement in the nation’s finances.

The November deficit — the gap between what the government takes in and what it spends — totaled $135.2 billion, the Treasury Department said Wednesday. That’s 21.4 percent lower than November 2012. And through the first two months of the budget year, the deficit totaled $226.8 billion, or 22.7 percent lower than the same period a year ago. The budget year begins Oct. 1.

Higher tax rates and a better economy have boosted revenue, and spending has slowed. Those trends helped shrink the annual deficit last year to $680 billion, the lowest in five years. Private economists predict the annual deficit this year will fall to about $600 billion.

The government ran annual deficits of more than $1 trillion in the previous four years, including an all-time high of $1.4 trillion in the 2009 budget year. The Great Recession led to a drop in tax revenue and an increase in emergency spending, such as unemployment benefits.

Save 75% on a Digital Subscription Today

The economy has gradually improved, and hiring has accelerated in the past four months. As more people find jobs, tax revenue rises and the deficit shrinks.

Declining unemployment has helped reduce the deficit as a share of gross domestic product by more than half in the past four years to $680.3 billion in the fiscal year that ended Sept. 30 from a record $1.42 trillion in 2009. The Congressional Budget Office projects the shortfall will shrink this year and next as stronger economic growth lifts individual and corporate taxes. The 203,000 increase in payrolls followed a revised 200,000 advance in October, according to the Dec. 6 report.

The median forecast of 89 economists surveyed by Bloomberg called for a 185,000 advance.