LONDON (Reuters) - British Prime Minister Theresa May won backing for her policy program with a slender parliamentary majority on Thursday in the first test of her authority after an election setback and growing pressure on her Brexit and austerity agenda.

Britain's Prime Minister Theresa May leaves Downing Street in London, Britain June 28, 2017. REUTERS/Stefan Wermuth

May cut short a visit to Berlin and her defense minister, Michael Fallon, left Brussels to dash back to Britain for the vote, underlining her precarious position after she lost her Conservative Party’s parliamentary majority in an election on June 8 that she did not need to call.

On Wednesday, she saw off an attempt by the opposition Labour Party to defeat her in a vote on public sector pay, thanks partly to the support of a small Northern Irish party which she secured under a deal to help her pass legislation.

It was that backing that helped her squeeze enough votes to pass her policy program, set out to parliament by Queen Elizabeth last week, winning with 323 votes to 309.

“This is ... the way we intend to govern. Living within our means, creating good jobs, paying people well, investing in the future by working with business ... implementing the will of the British people to leave the EU in a way that is orderly and sensible,” business minister Greg Clark said before the vote.

“We vote tonight not just on a program of legislation but on a fundamental approach to the future of this country.”

The vote was not without difficulties. Opposition parties proposed amendments which tested the discipline of May’s supporters and the government had to make a concession on abortion rights, making funds available in England for women arriving from Northern Ireland for abortions, to avoid defeat.

Other amendments challenged her stance on Britain’s departure from the European Union, demanding that the country stay in the bloc’s single market, and on austerity, criticizing her for not investing in the economy.

Both were rejected.

But the vote shows how difficult it will be for May to push through legislation needed to ease Britain’s departure from the European Union and underlines how little room for maneuver she has as Conservative lawmakers jockey for position to replace her.

Labour leader Jeremy Corbyn said the Conservative program was “in tatters” and should bend to the will of voters who wanted an end to public sector cuts, which some have blamed for a fire that killed at least 80 in west London and for straining a police service battling militant attacks.

“Theresa May does not have a mandate for continued cuts to our schools, hospitals, police and other vital public services or for a race-to-the-bottom Brexit. Labour will fight these policies every step of the way,” he said in a statement.

“Labour won support in every region and nation of Britain for our jobs-first Brexit approach and our policies that would transfer wealth, power and opportunity to the many from the few.”