Government borrowing rose by more than expected last month following subdued tax receipts and an increase in expenditure.
Borrowing jumped to £6.75bn last month from £4.35bn a year earlier, the Office for National Statistics said.
It was the first year-on-year rise in borrowing in August for three years.
However, borrowing for the year to date is 30.5% lower at £17.8bn, potentially giving Chancellor Philip Hammond room for manoeuvre in the Budget.
Economists had expected borrowing to be about £3.4bn last month.