TOKYO -- Japan appears once again to have defied the common wisdom, which predicted its economy would be laid low by the dollar's two-year slide, and is beginning the new year with remarkable confidence and economic strength.

While many experts predict sluggish growth this year for Europe and the United States, the Japanese economy is predicted to chug along with a nearly 4 percent annual growth. The engine of that growth will not be the U.S. consumers who have lifted Japan's economy in the past by buying Toyotas and Hitachis, but the Japanese themselves, who are showing a new willingness to invest in homes, cars and almost anything else that is new and expensive.

The domestic market, long stifled by the Japanese propensity to save and sacrifice for the future, is coming alive as U.S. officials have long demanded. Moreover, even Japan's exporting giants, which were expected to be reeling by now as the dollar's fall and yen's rise made their products more expensive overseas, are once again turning a profit. Many have turned the dollar's fall to their advantage.

Spurred by the realignment of exchange rates, Japanese industry has embarked on a basic restructuring that appears to have left the economy healthier than before while causing almost no unemployment. They have built new plants overseas, where real estate is now a bargain for those with yen, while streamlining production in Japan.

The seismic shifts of yen and dollar, far from rectifying the U.S.-Japan trade imbalance as U.S. officials intended, have in fact hastened Japan's coming of age as an economic superpower. When Prime Minister Noboru Takeshita visits Washington this week, he will be speaking for a nation with more per capita wealth than the United States, the world's largest securities firm, seven of the 10 richest banks, the most heavily capitalized stock exchange and the world's largest hoard of foreign exchange, meaning dollars.

A leading industrialist reflected this new strength last week when he said that Japan no longer has the most to fear from a falling dollar.

"Of course Japan will be hurt, but I think the U.S. will be hurt most," said Takashi Ishihara, chairman of the Japan Committee for Economic Development and of Nissan Motor Co. "If the dollar gets cheaper and cheaper, who will think of investing in dollars? . . . The United States will be in trouble."

Certainly, the rise of the yen has brought pain to some in Japan. Basic industries such as steel, shipbuilding and textiles have suffered, and the towns and workers that depend on them have suffered, too. Small and mid-size companies have gone bankrupt, and even some large firms, such as the weaker automakers, may have to merge.

Moreover, the future may be far rockier than expected, especially if the dollar continues to fall. Johsen Takahashi, a senior economist at Mitsubishi Research Institute, believes that Japan is facing a "hollowing-out" of basic industry that will lead to more unemployment and dislocation than most experts predict.

"For the time being, certainly, Japanese people may start spending more and enjoy spending more," Takahashi said. "But they are very much like people dancing on the Titanic when it is already halfway down."

Even the gloomy Takahashi, however, acknowledges that the Japanese adaptation to changing conditions so far has been impressive, calling to mind a similar recovery from the oil shocks of the 1970s.

In any case, Japan's present prosperity is a far cry from what most Japanese executives feared when the five major industrialized countries of the world began talking down the dollar in 1985. The Japanese economic miracle was founded on exports, the executives said then, and if those exports stopped, the miracle would end.

The Japanese miracle had, indeed, been founded on importing raw materials, turning them efficiently into cars and televisions and other industrialized products, and then selling those products overseas. A crowded island nation with few natural resources, Japan believed it had no other route to success.

By 1985, however, it had become clear that Japan was too successful. While driving U.S. automakers, electronics firms and other industries into or near bankruptcy, Japan would not buy finished products from overseas; its annual trade surplus with the United States grew from about $10 billion in 1980 to about $50 billion in 1985.

The five nations -- later joined by Italy and Canada -- therefore decided to drive down the value of the dollar, then worth about 240 yen. If the yen became more expensive, officials reasoned, Japanese products would become more expensive in the United States while U.S. goods would become cheaper here. The trade imbalance would narrow.

Put another way, the dollars that Sony earned by selling a television in Bethesda would be worth less when converted into yen back in Tokyo. To recover its costs of production, Sony would have to charge more dollars.

As the dollar tumbled to 200 yen by the end of 1985 and 160 one year later, the Japanese economy did indeed falter. During the second half of 1985 and into 1986, it grew more slowly than any time since the oil shock years of 1974-75.

Companies that depend on exports found themselves at a loss, and -- although U.S. products continued to fare poorly here -- Southeast Asian and Korean textiles, refrigerators and other imports began to take business away from Japanese companies on their home turf. In two years, about 300,000 manufacturing jobs were lost. Nissan Motor Co. lost money.

Last spring things began to turn around. The government committed new funds to public works projects, boosting the construction industry, and skyrocketing land and stock market prices encouraged ordinary Japanese to spend.

For the first time, Sony Corp.'s sales in Japan overtook its U.S. business, a company spokesman said. Toyota sold more cars in Japan than overseas in 1987 for the first time in seven years. Between June and September, the economy grew at the astonishing annual pace of 8.4 percent, even though exports continued to decline, dragging that figure down.

As the year closed with the dollar falling below 130 yen, the Japanese had purchased more new cars than in any previous year. With half the population and far less land, they also had built about as many homes last year as Americans.

"Large-TV sales are booming, video tape player sales are booming, camcorders and CD players are booming, too," Sony's Tsutomu Sugiyama said. His colleague Haruyuki Machida, added: "Particularly in the younger generation, people now are more apt to spend money."

But Sony, like most Japanese exporters, was not willing to cede the overseas market as the dollar plunged and domestic sales picked up. Sony, like many other firms, pursued long-range strategies to maintain its competitiveness abroad.

Exporters quickly realized that the exchange rate problem was also an opportunity. Resources such as oil, which are priced in dollars, suddenly grew cheap.

Even more important, they saw that just as it would cost more dollars to buy a Japanese television, so it would take fewer yen to buy American land, build American factories and hire U.S. workers. "Now that the dollar has depreciated so much, now is a good time to establish a production base," Machida said. "We have to look at it as a big chance."

Sony now has 21 plants around the world, with new plants opening this year in Italy, Malaysia and Thailand, where the currency has depreciated with the dollar against the yen. Almost all the color televisions Sony sells in the United States are now produced in Tijuana and San Diego.

Sony was not an exception. Sanyo Electric Co. announced last week that it will start exporting wide-screen televisions from the United States to Japan.

Overall, new Japanese investment overseas increased from $12.2 billion in fiscal 1985 to $22.3 billion in fiscal 1986, according to Tadashi Ezaki, a research director at the Ministry of International Trade and Industry. During the first six months of fiscal 1987, which ends in March, investment was running at a $31.6 billion annual pace, he said. Such overseas production allowed Japanese companies to hedge against currency changes. Although Sony's U.S.-assembled televisions contain some Japanese-made parts, 70 to 75 percent of their costs are local and by 1990 the figure will rise to as much as 90 percent; that means most of the price will not rise and fall with the dollar.

Ezaki said that such investment abroad, although clearly in the companies' interests, also worries industrial planners in his ministry. Overseas plants take jobs away from Japan and may lead to a divergence of interests between the big companies and the government, which formed the solid front of "Japan, Inc." for so many years.

"I know that in the United States 'hollowing-out' is said to be a big problem," Ezaki said. "Japan is now facing a situation where we have to think seriously about such a problem, too." But Ezaki said he believes the problem in Japan is manageable. About 600,000 more manufacturing jobs will be lost by 1995, he said, but that represents only 1 percent of the labor force, a number that can be absorbed by new industries.

Japan's overseas production is expected to grow from 4.3 percent of its total output in 1984 to 8.2 percent in 1993. But that will still be well below the U.S. 1984 rate of 16.1 percent.

"From that perspective, maybe our worry is less than the U.S. worry," he said.

Indeed, Japanese companies seem determined to keep manufacturing at home -- especially the most sophisticated, high-technology processes. Although Sony color televisions are now made in Tijuana, for example, its highest-quality monitors are still produced in Japan.

Sony also continued to make Walkmans in Japan. Instead of moving to a nation with cheap labor, Sony painstakingly re-engineered the product to cut the number of parts, and so the cost, in half.

"It's not a miracle or a mystery," Sugiyama said. "Every laborer, every woman worker, to the level of plant manager, they're all thinking how they can move this product as quickly as possible, with as little stress as possible, so they can move 2,001 Walkmans per hour instead of 2,000. Each step saves a penny or half a yen."

Sony also redoubled its research efforts to develop high-tech products for which there will be less competition and therefore less price pressure. By moving into areas like robotics and factory automation services, Sony managed to keep its Japanese workforce at full strength even while expanding overseas.

Like many Japanese firms, the company also was willing to squeeze its profit margin in the short term to maintain its strong presence in overseas markets. On average, Japanese exporting firms saw their profit margins tumble from averages of 4 and 5 percent in the low-yen, fat years of 1980 to 1985 to about 2.6 percent last year, according to a Bank of Japan study.

Despite all its efforts, Sony also had to raise prices last fall and again this month. But the price increases have been far less than the yen's doubling in value, and Machida said that 1987 should be a profitable year for the company.

"We may not have fully coped with this yen appreciation," he said, "but structurally, the foundation is established."

That cautious confidence is echoed by many firms. "Two years have passed, and the countermeasures have begun to work," said ministry official Ezaki. "Several companies are now saying, 'We can survive at 120 (yen to the dollar).'"

With Washington and Tokyo at odds on many trade issues, officials here are careful not to gloat. Takahashi, the Mitsubishi Research Institute economist, said that he believes the breaking point for the average Japanese exporter will prove to have been 130 yen to the dollar.

"The Japanese economy is going to be taken unaware," he said, articulating a minority view that is nonetheless not quickly dismissed here. "Beyond 130 is basically, fundamentally, qualitatively different. Something brand new is going to happen to Japanese companies as they enter this 130 to 120 yen range." The dollar opened today a 128.35 yen on the Tokyo foreign exchange market.

That something new, he said, is the realization that they cannot profitably export from Japan when wages are so high in relation to the rest of the world. More companies will move offshore, jobs will be lost, the stock market may tumble.

"The carefree spending binge will be very shortlived," he said. Takahashi acknowledged that some exporters will survive cost cutting and innovation. But he said the potential for such progress is limited in many basic industries.

"The Japanese economy cannot live on Walkmans alone," he said.

The economist also acknowledged that it was inevitable that Japan would move away from steel, textiles and other basic industries as South Korea and other rising Asian nations progress. But the suddenness of the dollar's fall will accelerate the transition so sharply that Japan will have too little time to adjust, he said.

Many executives do not share Takahashi's pessimism, but they also remain uneasy, unwilling to believe in their latest success, their world view colored by a classic Japanese sense of isolation and vulnerability.

Rokuro Ishikawa, head of the Japanese Chamber of Commerce and Kajima Construction Co., was asked recently why Japanese firms do not seem to be complaining anymore about the high yen. "The reason you don't hear us screaming," he said, "is that people have no time to scream. They are silent, trying to survive."Special correspondent Shigehiko Togo contributed to this report.