Government borrowing for the current financial year has risen to £22.8 billion, despite a small surplus in July following a rise in tax receipts.
The Office for National Statistics (ONS) said public sector net borrowing, excluding public sector banks, increased by £1.9bn between April and July, compared to the same period in 2016.
That is despite an increase in tax receipts in July, which helped deliver a small surplus of £200m last month.
The UK's finances tend to enjoy a strong July as self-employed people pay their income tax and businesses settle their corporation tax bills.
Receipts from self-assessed income tax increased by £0.8bn to £8bn year on year in July, the the highest level on record.
The ONS said last month's surplus was the first since July 2002.