WASHINGTON — A flood of economic stimulus payments pushed the federal budget deficit to an all-time high of $165.9 billion in May.

The Treasury Department reported Wednesday that the May deficit was more than double the imbalance in May 2007, reflecting $48 billion in payments as part of the government's $168 billion economic stimulus effort to give the economy a jump-start and keep the country from falling into a deep recession.

For the first eight months of the budget year, the deficit totals $319.4 billion, slightly below the all-time record for this period of $346 billion, set in the 2004 budget year.

The Bush administration estimated in February that the deficit for this year would total $410 billion, just below the all-time high in dollar terms of $413 billion in 2004. However, many private economists believe that this year's deficit will exceed the previous record, reflecting not only the economic stimulus program but also the impact of the weakening economy on government receipts.

Through the first eight months of this budget year, which began on Oct. 1, receipts have totaled $1.67 trillion, a small 0.3 percent increase from the same period a year ago, as both individual tax payments and corporate tax payments have shown the effects of the sluggish economy.

Outlays, however, are up a sizable 9.7 percent to $1.99 trillion, reflecting the stimulus payments and also the ongoing costs of fighting wars in Iraq and Afghanistan.

The $319.4 billion deficit total for the past eight months is more than double the $148.5 billion deficit for the same period in 2007.

Part of the increase in the May deficit reflected a timing issue for certain government payments. Since June 1 fell on a Sunday, about $20 billion in government outlays were shifted into May, making the deficit for that month larger.

The government normally runs a deficit in May. The only surplus since 1954 occurred in May 1960.