LONDON (AP) _ Enterprise Oil PLC said Wednesday it has reached an agreement with British Gas PLC and Amerada Hess Corp. of the United States under which each of the three companies is permitted to buy parts of Texas Eastern North Sea Inc., the North Sea oil assets of Texas Eastern Corp.

Enterprise Oil had planned to buy the Texas Eastern assets on its own for $961 million, but British Gas and Amerada Hess won a British court case which ruled that the deal would contravene a 1965 exploration agreement which granted British Gas and Amerada Hess pre-emptive rights on the Texas Eastern assets.

The court ruled that all three companies should be allowed to buy a share of the Texas Eastern North Sea assets.

Under the new agreement, Enterprise said it will pay $289 million plus accumulated interest for all or part of Texas Eastern North Sea's interests in three producing North Sea Fields, two fields under development and a number of exploration prospects.

These interests contain estimated oil reserves of 93 million barrels, or 32 percent of Texas Eastern's total estimated reserves of 285 million barrels. These interests will be acquired immediately.

The remainder of Texas Eastern's interests will be divided between British Gas And Amerada Hess.

Following the announcement, British Gas shares rose 1.5 pence, or 2.3 cents, to 2.07 pounds, or about $3.18, while Enterprise Oil shares climbed 5 pence to 6.08 pounds.

Earlier this year, Enterprise Oil paid $422 million for a number of Texas Eastern's exploration and production interests in Norway, Indonesia, Denmark, the Netherlands and Alaska.

Enterprise said the addition of the Texas Eastern interests would lift its total production to around 115,000 barrels a day, compared with an average 60,000 barrels a day in 1988.

''While it is disappointing not to have been able to complete the totality of the Texas Eastern acquisition, the deal represents a sensible resolution of the outstanding issues,'' said Enterprise Oil Chairman William Bell.

''We are now well placed to become the U.K.'s leading independent enterprise and production company.''

British Gas and Amerada together will pay $673 million plus interest for the remainder of the Texas Eastern interests not owned by Enterprise. Of those assets, British Gas will hold 63 percent while Amerada will take the remaining 37 percent interest.

The companies said they plan to run Texas Eastern North Sea as a company using ''the existing organization and staff resources.''