The government is on course to overshoot its budget target by at least £8bn this year after extra spending on the NHS and preparations for a no-deal Brexit cut the surplus in July.

The public finances were down by £2.2bn compared with July 2018 to leave a £1.3bn surplus last month. The decrease was almost entirely accounted for by rises in central government spending, much of it on staff salaries, as Whitehall departments stepped up hiring to cope with the impact of Brexit.

Last month, Sajid Javid, the chancellor, said the government would meet pledges for extra spending on police, defence, the NHS and Brexit planning after he agreed to a one-year extension from next March to Whitehall budget plans.

A 0.5% slide in government revenues also contributed to the worsening figures after an increase in the personal allowance – the amount people can earn without paying income tax – reduced the Treasury’s revenues.

Over the first four months of the financial year, borrowing totalled £16bn – 60% higher than in the same period in 2018-19, the Office for National Statistics (ONS) said.

John McDonnell, the shadow chancellor, said extra borrowing to prepare for a no-deal Brexit was irresponsible and showed the government was mismanaging the economy.

“Instead of borrowing yet more money to fund their failed programme of tax cuts, the priority has to be reversing the damage done to schools and social care, and stopping the rollout of universal credit which is causing so much hardship,” he said.

Howard Archer, the chief economic adviser to the forecasting group the EY Item Club, said the cumulative effect was likely to be the public sector net borrowing requirement being £8.5bn higher by the end of the year than the Office for Budget Responsibility has forecast.

The OBR, which provides independent economic forecasts for the Treasury, predicted in March that the government’s net borrowing was already likely to increase from £23.6bn in 2018-19 to £29.3bn in this financial year.

“July is typically a month where the public finances are in surplus, given that it sees many medium-sized and large companies, as well as oil and gas firms, make corporation tax payments. While the second payment on account for self-assessment liabilities is also due,” he said.

“But central government revenues were down 0.5% on a year earlier, reflecting a combination of weak activity and the generous increases in income tax allowances which came into force in April. At the same time, current expenditure has continued to run at a pace well ahead of that implied by the full-year plans.”

Central government current expenditure grew by 4.2% year on year in July, exceeding the OBR’s full-year estimate of a 2.7% rise.

Capital Economics said there were worrying signs that corporation tax receipts were weakening following a 0.1% year on year fall in the first four months of the financial year, the first drop in the April-July period since 2013-14.

But it expects the economy to stabilise over the next eight months of the financial year, leaving the deficit to rise by only £3.5bn more than the OBR expected.

Javid has signalled he will go ahead with a budget in the autumn that will reflect the need to find extra funds and No10’s demand for lower taxes. The budget must also cope with a reassessment of student loan liabilities in the public finances by the ONS, which is expected to add more than £10bn to the annual debt pile.