The U.S. trade deficit, which has become the most closely watched economic indicator for financial markets since the stock market collapse on Oct. 19, declined sharply to $13.2 billion in November as exports reached their highest levels ever and imports dropped.

Within minutes of the Commerce Department's announcement, which exceeded the most optimistic expectations, the dollar jumped in value against all major currencies in European trading and shares on the London stock exchange, which had been down slightly, zoomed up to close 43.3 points higher.

On the New York Stock Exchange, which opened an hour after the trade figures were released in Washington, prices shot up immediately, with the Dow Jones industrial average gaining more than 50 points by midday. The Dow closed at 1956.07, up 39.96 points. Bond prices rose up sharply, with the bellwether 30-year Treasury issue soaring 2 5/8 points.

The dollar soared to 130.95 Japanese yen in New York trading from 126.17 yen Thursday as buyers rushed for the U.S. currency.

The improvement in the nation's deep trade deficit is a powerful tonic for stock traders because it eases fears of an increase in interest rates.

To remedy the trade deficit, the Federal Reserve and the Reagan administration had permitted the value of the dollar to fall, making American products less expensive on world markets.

But last month, in a policy shift, authorities agreed to defend the dollar against a further decline because the cheaper dollar was causing economic problems in Europe and Japan and boosting fears about a return of inflationary pressures. (A lower-valued dollar raises prices of imported goods in this country).

Had the trade deficit not turned around in November, the administration and the Fed would have faced a hard choice between letting the dollar slide again, or boosting interest rates.

Adding to the positive economic news yesterday, the government reported continued low inflation with a 0.3 percent fall in wholesale prices in December. Industrial production, while slowing its rate of growth, increased 0.2 percent last month. {Story on Page G1.}

"As I've been saying all along, the fundamentals in the United States economy remain strong," President Reagan said in a prepared statement that he read on the White House lawn before boarding a helicopter for a medical examination at Bethesda Naval Hospital.

"Industrial production is up. Inflation is down and this country continues on the long trend of sustained growth." Noting the increase in exports, he added, "Our competitive position in the world is steadily improving."

White House spokesman Marlin Fitzwater said he hoped that the trade improvement would move lawmakers away from a protectionist trade bill and put them in a better mood to compromise with the Reagan administration.

The report of a worse-than-expected trade deficit for August touched off a 95-point fall in the Dow Jones industrial average when it was reported on Oct. 14, triggering "Black Monday" on Oct. 19 when the stock market plunged 508 points. The report last month of a record trade deficit for October set off a 47-point drop in the Dow and was blamed for driving the dollar down to its lowest levels since World War II. The dollar has rebounded slightly since then as industrialized nations have pledged coordinated efforts to prevent its free fall.

Yesterday's report of a $13.2 billion trade deficit for November was a 25 percent improvement from October's record-high monthly deficit of $17.6 billion. It was the best monthly trade showing since April, when administration officials began predicting an end to five years of record trade deficits only to have their optimistic forecasts of a turnaround dashed by numbers that grew worse.

Nonetheless, the 1987 trade deficit is likely to set another record of about $170 billion -- crushing Reagan administration hopes earlier last year of a $20 billion to $30 billion improvement. The 1986 deficit was $156 billion.

The November improvement was paced by $23.8 billion in U.S. overseas sales, an increase of $2 billion from October's export level and listed by Commerce Department economists as the highest monthly export level ever. Included in the total export figures is $16.2 billion in overseas sales in the critical area of manufactured goods, which is also the best monthly showing. Farm exports were also up, a $149 million increase to $2.7 billion.

This export strength was considered especially significant since overseas sales traditionally decrease in November.

"Across the board, the manufacturing exports look good," said William T. Archey, international vice president of the U.S. Chamber of Commerce. He noted that the November exports are not only an improvement over October, but also are higher than the $20.4 billion average for the first 10 months of the year.

U.S. Trade Representative Clayton K. Yeutter added that the November figures show "we are already in the middle of an export boom," not just on the verge of one.

"All of us can now take satisfaction in the strong upward trend of American exports," said Commerce Secretary C. William Verity Jr. "In fact, exports are now the chief engine of economic growth, up nearly 20 percent from a year ago," and "the main source of the recent surge of production and jobs in manufacturing."

Further, the U.S. appetite for foreign products appears to have abated. Imports dropped to $37 billion, down $2.4 billion from October's record high that was blamed on a surge of Christmas orders. The November decrease included a $1.5 billion drop in imports of manufactured products.

John Oliver Wilson, senior vice president and chief economist of the Bank of America in San Francisco, noted imports dropped in industries where the United States is considered internationally competitive: telecommunications equipment, office machinery, air craft, electrical machinery and power generators. But imports of cars and steel products increased, indicating those industries still have a long way to go to persuade American buyers they are as good as foreign products, he said.

Analysts have noted that the U.S. trade performance looks worse than it really is because the sharp fall in the value of the dollar over the past three years has made foreign goods more expensive in this country. At the same time, the currency change makes U.S. products less expensive, and more competitive, overseas.

"While the detailed price statistics are not yet available, it is clear that the real volume of imports was well below imports in November a year ago, a sign that U.S. industry is beginning to regain the home market" from foreign competitors, noted Verity.

In addition, the U.S. deficit improved with all of its major trading partners, including a sharp $1.1 billion decrease with Japan, down from $5.9 billion in October.

Forecasters had predicted the trade deficit would fall from its October high, but not as much as it did. Michael Evans of Evans Econometrics predicted a $16 billion deficit, but noted that the consensus was lower, around $15.2 billion. Allen Sinai, chief economist of The Boston Co., forecast a $15.3 billion deficit. Analysts predicted earlier this week that markets would rise strongly and the value of the dollar would increase if the trade deficit fell below $14 billion and the markets would collapse if the figure was greater than $16 billion.