Britain's public finances were back in the black last month as a surge in self-employed workers' tax payments boosted the Treasury's coffers.
The surplus of £184m is the first in any July since 2002, figures from the Office for National Statistics (ONS) show.
Economists had expected the Treasury to record a deficit of £1bn, up from the £308m additional borrowing in July 2016. But instead rising self-assessment tax receipts gave the Chancellor a boost.
The July figures show that payments of self-assessed income tax increased by 11pc from the same month of last year to £8bn, the highest level since records began in 1999.
As well as the self-assessed income tax, the Treasury also received a boost from a 5pc climb in value-added tax revenue.
HM Treasury's current tax receipts rose by 3.6pc compared with July 2016, while spending only increased 1.6pc.
However, the deficit for the financial year to date is still up compared with last year.
From April to July the government borrowed £22.8bn, up from £20.9bn in the same period a year ago.
Overall the deficit for the year is expected to rise from £45.1bn last year to £58.3bn this financial year, though the deficit in July may raise hopes that the government efforts combined with a growing economy and high employment could limit the rise.
Ruth Gregory, UK economist at Capital Economics, said the surplus is likely to be a “temporary blip”.
She said: “July’s public finances brought some cheer for the Chancellor after the run of fairly poor outturns seen so far this fiscal year.
“But this will probably prove to be just a temporary blip, rather than the start of a more sustained improvement.”
Economist Philip Shaw at Investec said: "So far this year, the deficit is rising at an average of close to £0.5bn per month. Were this to be maintained over the remaining eight months, borrowing over 2017-18 as a whole would rise to £50.8bn."
A spokesman for the Treasury said: “We are making good progress in strengthening our public finances and living within our means.
“Our national debt, at £65,000 for every UK household, is still too high. That is why we have a clear fiscal plan to reduce our debts and build a stronger economy for every household.”
The ONS said public sector net debt, a figure which excludes the borrowing undertaken to bail out the banks in the financial crisis, has jumped by £143.9m to £1.76 trillion since July last year, and now equates to 87.5pc of GDP.
Those mounting debts are becoming increasingly expensive to service despite interest rates which are very low by historical standards.
In particular the rising rate of inflation is pushing up the payments on index-linked bonds.
Interest payments hit £4.9bn in July, up 18pc from the £4.1bn paid in the same month of 2016.
Source: The Telegraph