Maine’s state government had a budget surplus of more than $40 million for the month of August, officials with the governor’s office said.

The office of Democratic Gov. Janet Mills said the $42.4 million surplus for the month beat expectations by nearly 12 percent. The office said general fund revenues for the first two months of the fiscal year were up $186.5 million, and that was an increase of almost a third from the same period last year.

The state has been able to grow its surplus because of factors such as the federal stimulus programs and its own level of savings, said Kirsten Figueroa, the commissioner of the Maine Department of Administrative and Financial Services.

Maine finished the last fiscal year with a surplus as well. More than $220 million of it was moved into the state’s budget stabilization fund, which is also sometimes called the “rainy day” fund.