OTTAWA -- The federal government posted a surplus of $3.95 billion for the first two months of its 2015--16 fiscal year, helped by increased tax revenue and the sale of its remaining shares in General Motors.

The result compared with a deficit of $1.15 billion in the same period last year, the Finance Department's monthly fiscal monitor said.

Revenue for the two-month period increased to $49.05 billion compared with $43.5 billion last year due to the GM share sale, as well as higher revenue from income tax, excise taxes and duties.

Meanwhile, program spending increased to $40.02 billion compared with $39.45 billion a year ago due to increased major transfers to persons and other levels of government, offset in part by lower direct program spending.

Public debt charges totalled $5.08 billion, down from nearly $5.2 billion in the same two-month period last year.

The budget in April forecast a surplus of $1.4 billion for the entire fiscal year, however since then the economy has grown less than expected and prompted speculation that Ottawa will fall short.