TOKYO (AP) _ In a move that could ease U.S.-Japan trade tensions, Nippon Telegraph and Telephone Corp. said Wednesday it has decided to purchase a third supercomputer from the United States.

The $20 million supercomputer, manufactured by Cray Research Inc. of Minneapolis, will replace one of two Cray supercomputers NTT already has, spokesman Yoshio Katsumata said.

NTT did not make the decision because of trade considerations, and was not pressured into the purchase by the Japanese government, Katsumata said.

''We just decided for economic and technological reasons,'' he said. ''It may help ease 'anti' sentiments in Washington, but that's not our first objective.''

But Ryuichiro Yamazaki, director of the Foreign Ministry's First North American Division, said, ''Since it (supercomputers) is a pending issue between the two countries, it will help to ease trade tension. We're doing our best to accommodate requests from the U.S. side. We're very happy about the NTT decision.''

The United States, which ran a $58.6 billion deficit in trade with Japan last year, according to U.S. calculations, has complained that U.S. firms lack access to Japan's market for supercomputers - large, complex computers that perform intricate calculations at lightning speed.

Although the United States dominates the world market for supercomputers, U.S. officials point out that nont one of the 20 or so public-sector supercomputers installed or on order in Japan is a non-Japanese machine.

The NTT purchase also comes amid a sharp dispute over trade in semiconductor chips, key building blocks in electronic equipment.

The U.S. government has decided to levy penalty duties of up to 100 percent on up to $300 million worth of Japanese electronics goods because, it says, Japan has sold computer chips at unfairly low prices overseas and has not opened its markets to U.S. chips in violation of an agreement reached last summer.

Commerce Secretary Malcolm Baldrige said Tuesday in Washington that ''there will no last-minute reprieve'' from the sanctions, scheduled to take effect April 10.

Japanese government officials have said that if the United States imposes the penalties, Japan would seek redress under the General Agreement on Tariffs and Trade, and might abrogate the semiconductor accord entirely.

U.S. Trade Representative Clayton Yeutter also said in Washington Tuesday that while a ''retaliatory response'' from the United States could not be avoided, the sanctions could be short-lived if Japan adheres to the semiconductor pact.

NTT, the government's telecommunications monopoly until its conversion to a private firm one year ago, chose the Cray II supercomputer because it has 10 times the information processing capacity of the initial Cray, purchased in 1984, Katsumata said.

''We spent a lot of time and money and resources to develop software,'' he said. ''It is necessary to buy a Cray to keep using our existing software.''