SAN JOSE -- After years of fighting an uphill battle to sell overseas, Silicon Valley manufacturers are getting a break. The dollar has weakened enough against foreign currencies to erase some of the advantages long held by major producers in Japan and other countries, according to some industry observers.

The greatest beneficiaries could prove to be old-line manufacturing industries in the Midwest and East, such as steel. But California should see stronger demand for its principal exports, ranging from computers to almonds.

For Silicon Valley companies, the signs of improvement are surfacing:

Semiconductor companies are finding that the cost advantage of Japanese competitors has vanished and U.S. chip sales are rising in Japan. In August, U.S. firms captured 9.6 percent of the Japanese chip market, up from 8.5 percent in August 1986, according to the Semiconductor Industry Association.

Computer companies report that overseas markets are stronger in some cases than domestic markets. Partly because of the weaker dollar, Hewlett-Packard Co. of Palo Alto -- Silicon Valley's largest exporter, according to Fortune magazine -- saw overseas sales jump 21 percent to $4 billion in the 12 months ended Oct. 31. H-P's U.S. sales, meanwhile, rose 8 percent to $4.1 billion.

Export consultants say managers are shifting more of their attention to breaking international barriers as a way of expanding sales. "There is no U.S. market by itself," said Mark Nehamkin, president of International Technology Consortium, a San Jose export consulting firm. "There is only a global market."

While the weak dollar is helping Silicon Valley companies, many executives are reluctant to ascribe overseas sales gains and losses to that alone. Electronics companies sell products on the basis of quality, design and service, as well as price, making the competitive battle long term and difficult.

However, the decline is helping turn the tide of the electronics trade deficit. For the first time in three years, the U.S. electronics trade deficit shows signs of improving both with Japan and with the world in 1987.

The American Electronics Association estimates that the United States by the end of this year will have bought $10.5 billion to $11 billion more than it exported in computers, telecommunications, semiconductors, software and electronic instruments. That's down from a $13.1 billion deficit last year.

The electronics deficit with Japan will hit $18 billion in 1987, a drop from $20.4 billion last year, the AEA said.