Image copyright AFP Image caption Chancellor Philip Hammond will present the latest Budget on Wednesday

UK public sector borrowing rose to £8bn in October, official figures show, up £500m from a year earlier.

The figure comes a day before the Budget, and the monthly deficit was bigger than economists had predicted.

Increased debt costs, linked to the UK's higher inflation since the Brexit vote, were a factor in the shortfall.

The Office for National Statistics (ONS) said borrowing for the financial year to date has fallen £4.1bn to £38.5bn, from the same month last year.

That figure suggests borrowing is on track to come in below the Office for Budget Responsibility's forecast of £58.3bn for the financial year as a whole.

Analysis: Andrew Verity, economics correspondent

Image copyright Reuters

It's not often over the past 15 years that the public finances have been a cause for optimism.

If you're a pessimist you could happily use the latest numbers to keep up the eight-year tradition of anxiety and hand-wringing about government debt growing out of control.

At £8bn, the amount the public sector (central government, local government, health authorities etc) had to borrow to meet its monthly costs in October was higher than most economists had expected.

But expectations had been downbeat.

The Office for Budget Responsibility's forecast, soon to be revised, was that the government would have to borrow £58.3bn this year to plug the gap between its income from taxes and its spending (the deficit).

That would be £12.5bn more than last year. But now it looks like it will come in well below that - so that if the deficit grows it will not be by much.

Better then look at debt. If you strip out the Bank of England borrowing artificially accumulated through quantitative easing, you get a net debt of £1,632bn.

While that's grown by £46.1bn, the economy's grown faster - meaning that as a percentage of the economy (GDP) it's shrinking.

And that means it's becoming more manageable, not less.

Chancellor Philip Hammond will present the latest Budget on Wednesday. He has to balance calls for more government spending against the prospect of weaker future economic growth, which could affect tax revenues.

John Hawksworth, chief economist at consultants PwC, said the chancellor faced "some tough choices in the Budget given a likely deterioration in the medium-term public borrowing outlook."

"While we do expect some giveaways in the Budget on housing, health and some areas of public sector pay, we also expect these to be largely offset by clawbacks in other tax and spending areas."

Government borrowing has generally been falling since its £152.5bn peak in 2009.

Last year it was about one third of that 2009/10 figure at £45.7bn, representing 2.3% of the size of the economy, or gross domestic product (GDP).

One of the main reason for last month's spike upwards was inflation, making it more expensive for the government to service its debts.

The government does some of its borrowing by selling "index-linked gilts", and the interest it pays on these is directly linked to the Retail Prices Index (RPI).

Over the last year the RPI has doubled from 2% to 4%.

The ONS said the £6bn debt interest paid by the government last month was the highest October interest payment on record.

The government's total debt has risen to nearly £1.8 trillion.

But the figures have been skewed by the Bank of England and its quantitative easing programme. This has involved massive purchases of government bonds which have been taken on to the government books and now count as part of the overall debt figure.

If these are taken out of the calculations then net debt stands at £1.6trn, almost exactly the same as this time last year.