LONDON — Britain’s Conservatives signed a deal on Monday with Northern Ireland’s Democratic Unionist Party that will allow Prime Minister Theresa May to govern after losing her majority in a general election this month.

The deal, reported to provide Northern Ireland with additional funding of about $2 billion over five years, will enable Mrs. May to win a clear majority vote in Parliament on Wednesday on the legislative program her government set out last week. Without the support of the D.U.P., Mrs. May risked losing that vote of confidence, which would have opened the way for the opposition Labour Party to try to form a minority government of its own.

The Northern Irish party, socially conservative and largely Protestant, has 10 members of Parliament. After nearly two weeks of negotiation, mostly about money for the province, its leader, Arlene Foster, agreed to what is known as a “confidence and supply” agreement with Mrs. May. The documents were signed in Downing Street by lesser figures.

Mrs. May was quoted by the Press Association as saying that the pact was a “very, very good one” and that the two parties “share many values,” including “the desire to ensure a strong government, able to put through its program and provide for issues like the Brexit negotiations.” Ms. Foster said she was “delighted that we have reached this agreement, which I think works, obviously, for national stability.”