The federal government posted a surplus of $3.9 billion for the first five months of its 2022-23 fiscal year.
In its monthly fiscal monitor, the finance department says the result for the April-to-August period compared with a deficit of $57.2 billion for the same time last year.
Government revenue for the period totalled $177.2 billion, up from nearly $149 billion a year ago, helped higher by broad-based improvement.
Program expenses excluding net actuarial losses amounted to $154.5 billion compared with $190 billion in the same period last year.
Public debt charges totalled nearly $14.8 billion for the period, up from nearly $9.7 billion.
Net actuarial losses totalled nearly $4.1 billion, down from $6.4 billion a year earlier.