The Senate broke a logjam delaying action on its sweeping trade bill early this morning and voted 58-40 to repeal the windfall profits tax that oil companies have been fighting for seven years.

Repeal of the oil tax came as legislators worked past midnight after a day of negotiations yesterday among leaders designed to bring a vote on the long-delayed trade bill by 6 p.m. next Tuesday.

Majority Leader Robert C. Byrd (D-W.Va.) dropped efforts to avert harnessing the tax repeal to the trade bill that had brought the Senate to a standstill earlier this week.

There was no discussion of the repeal plan, which was heavily debated on Tuesday night.

Supporters of repeal, led by Sen. Phil Gramm (R-Tex.), say the 1980 tax is unfair to oil-producing states hit hard by a price drop last year. Critics concede the levy has yielded no revenue lately but say it would again before automatically expiring in 1991.

The tax represents a response to the energy crisis of the 1970s and an effort to capture for the government some of the oil earnings that were skyrocketing then.

The tax is triggered for different types of oil at different price levels. For the cheapest type of oil, it kicks in when the price of a barrel of crude reaches $19. It currently is about $18.50.

As the clock neared midnight, leaders emerged from their discussions to seek unanimous Senate consent to break their legislative logjam.

Earlier, the Senate, pointing to the sale of submarine silencing equipment to the Soviet Union, voted to impose a new limit on export of highly critical goods and technologies.