U.S. President Barack Obama has signed what he has described as an "imperfect" spending bill to keep the government running through September 30.

Mr. Obama signed the legislation Wednesday.

The $410 billion spending bill contains funding for some 8,000 projects inserted by lawmakers for their home districts or states, a process known as earmarking. The cost of those projects totals more than $7 billion.

Earlier in the day, Mr. Obama said the bill is the final part of last year's budget, and that it must mark an end to the "old ways" of doing business and the beginning of a new era of responsibility and accountability.

He said earmarks can be used to direct federal money to worthy projects. But he said that on occasion, earmarks have been used as a vehicle for "waste, fraud, and abuse."

He called for the projects to be open to review, and said if administration officials determine an earmark has no legitimate purpose, they will work with Congress to eliminate it.

The president's comments came as the Treasury Department announced the federal deficit swelled to nearly $765 billion in the first five months of the budget year. The February deficit reached more than $192 billion, a record for the month but still lower than analysts expected.

The Democratic-controlled Senate on Tuesday approved what is called the "omnibus" spending bill by a vote of 62 to 35. The House of Representatives had already approved the bill.

A majority of Senate Republicans have criticized the spending bill as being too costly. Fiscal conservatives in both parties objected to the large number of earmarks.