The Government had to borrow just £5.6bn to balance the budget in August, which is the smallest amount recorded for that month since the 2007 financial crisis.
The figure, which does not take state-owned banks into account, was well below economists' expectations of £7.1bn.
It was largely a result of strong revenues from VAT, which rose by 5.6% on the year to £11.6bn.
Sterling was generally ambivalent, trading down slightly after a hefty drop against the dollar on Wednesday following news that the US Federal Reserve would begin unwinding its quantative easing programme.
The headline figure will be good news for Chancellor Philip Hammond, but the data from the Office for National Statistics also showed issues elsewhere.
National debt has risen to the equivalent of 88% of the country's gross domestic product (GDP), which is an increase of £151bn or almost 5% on August last year.
And revenue from corporation tax fell by 4.3% across the month to £4.8bn.
"The fact that the Government ran the first July budget surplus in more than a decade shouldn't distract from the bigger picture," said Sumita Shah, public policy manager at the Institute of Chartered Accountants in England and Wales.
"We continue to spend more than we raise, and borrow more.
"The truth is, that average net national debt is expected to grow to just under £2tn in the next five years.
"Put into perspective, £2tn has 12 zeroes, this is an enormous public liability. Monthly reporting simply blurs this fact into confusion.
"The Chancellor must start focusing on more long-term strategies to bring the public finances back into the black."