LONDON (Reuters) - Britain's government borrowed slightly more than expected last month, but its budget shortfall was the smallest for any May since 2007, official data showed on Tuesday.

The Office for National Statistics said public sector net borrowing, excluding state-controlled banks, totaled 9.745 billion pounds in May, down 3.8 percent compared with a year ago.

Economists in a Reuters poll had forecast a shortfall of 9.352 billion pounds.

The figures could make mixed reading for finance minister George Osborne, who is banking on Britons voting to remain in the European Union in Thursday's referendum.

Receipts from income, corporation and VAT taxes were all higher than a year ago, despite worries the economy has slowed in the run-up to the referendum. But the government's total current expenditure was also higher than a year ago.

The finance ministry last month said an economic shock following a British departure from the European Union could raise public sector net borrowing by 24 billion pounds in the next 2017/18 financial year. In the case of a severe shock, it could rise by 39 billion pounds.

Both the Treasury and Bank of England say the economy is suffering from uncertainty about the outcome of the referendum.

Osborne last week said Britain risks a loss of confidence in its public finances if it votes to leave the EU on June 23 and does not pass an emergency budget in the next couple of months.

Britain's poorest households would probably bear the brunt of a hit to the nation's public finances that would follow a decision to leave the EU, the National Institute of Social and Economic Research (NIESR) said earlier this month.

The ONS revised down its estimate for public sector net borrowing, excluding banks, to 74.9 billion pounds in the 2015/16 financial year, from 76.0 billion pounds last month.

This mostly reflected lower local government borrowing than previously thought.

Osborne has prioritized fixing the public finances since he became finance minister in 2010 when the deficit exceeded 10 percent of GDP. But progress has been slowed by weak economic growth, in part due to problems in the euro zone. Some economists say his austerity plan has been counterproductive.

Osborne is aiming to turn the deficit into a surplus by the end of the decade.

(Reporting by Andy Bruce and Ana Nicolaci da Costa)