DETROIT — General Motors and the United Auto Workers announced Thursday that they have hammered out a three-year contract providing increased job security for GM workers, averting a long-threatened nationwide strike.

The tentative settlement, covering 370,000 active and laid-off workers, still must be approved by a 300-member council of union leaders as well as by the union's rank-and-file.

Details of the agreement were not revealed, but UAW President Owen Bieber praised the agreement, saying that the contract will "achieve job security for our GM membership and make stable employment a part of the way this corporation does business."

GM's chief negotiator Alfred S. Warren said: "This settlement insures unprecedented job security and provides significant economic gains for our hourly employees. . . . At the same time, we have established a framework which provides opportunities for General Motors to increase its competitive capability."

The agreement came after weeks of intensive negotiations, during which the union sought to pressure GM into accepting a contract patterned after one it worked out at Ford in September. That agreement is expected to provide unprecedented levels of job security for Ford workers.

In recent days, top GM executives had hinted at an increased willingness to accept the Ford pattern in the key area of job security, an issue which has been the union's top priority all year.

Since GM has already announced plans to shut 16 facilities, idling a total of 36,000 workers, by the end of 1990, the union's rank-and-file has made it quite clear to the UAW's leadership that they would sacrifice large wage gains in exchange for greater employment guarantees.

Union officials, who had said earlier that they would demand GM provide a contract similar to the Ford settlement, seemed pleased with the tentative GM pact; it is reportedly structured along the same lines as the Ford contract.

Details Not Clear

But what was not clear Thursday was just how closely the GM pact will resemble the Ford agreement, which calls for a moratorium on plant closings and a $500-million fund that will keep many laid-off workers at full pay for the life of the contract. Both Bieber of the UAW and GM's Warren refused to say whether the GM contract fit the Ford pattern.

The GM settlement came with surprising ease, following months of speculation by industry observers that GM would be hard-pressed to avoid a strike this year.

Struggling through a period of sagging sales and declining profits, GM is burdened with more than three times as many hourly workers and many more money-losing parts plants than Ford; company officials have long warned that they must find a way to make their parts divisions more competitive with outside suppliers if the auto maker is to avoid massive plant shutdowns. In the early stages of the talks, GM even sought a new two-tier wage system that would pay parts plants workers less than those in assembly plants, but the UAW successfully fought off such demands. Because of such hurdles, Donald F. Ephlin, the director of the UAW's GM Department, said the talks were some of the most difficult in which he had ever been involved. Still, the two sides were able to amicably settle Thursday even before the UAW had set a formal strike deadline.

GM Chairman Roger B. Smith said in a brief press conference that the peaceful settlement means that GM can now launch its new 1988 models this fall without disruption.

"It's an important time for us for new models," he said, "and the fact that we were able to reach a good settlement without a strike is very important to both sides.

"I think the job security provisions in this agreement mean that there is a good basic foundation now for both sides to work together to improve our productivity, improve our quality and improve our costs, and I think that's something were both dedicated to."

The next step in the union's contract approval process comes Monday, when the UAW's 300-member GM council meets in Chicago to vote on the tentative agreement.