The stock market, in dramatic and sudden late afternoon gains, moved up sharply today, as the Dow Jones Industrial Average rose more than 20 points to its highest close in almost 10 years.

The Dow industrials closed the day at 1,034.12, the highest point since January 12, 1973, when it closed at 1,039.36, the day after the closely watched measure of blue-chip stocks set its all time record, 1,051.70. So far this week, the 30 industrial stocks that make up the Dow are up 41 points.

Robert Stovall, senior vice president at Dean Witter Reynolds Inc., likened the trading behavior to a professional basketball game. "There has been no real action until the late hours," Stovall said. "They watch each other on the floor, don't quite know what to do and when it looks like the selling is over and they're going up, everybody leaps in.

"This kind of activity boggles the mind," Stovall said. "It is beyond any benchmarks of past performance. No one has ever seen a market that acts like it has the past few months."

Although the market had edged up throughout midday, with the Dow industrials up less than eight points a half hour from the 4 p.m. market close, an intense buying surge lifted a broad range of stocks on all exchanges during the last half hour of trading. In particular, institutional and foreign buyers led the rally with moves prompted by efforts to cover massive short positions, analysts said.

"The shorts got squeezed," said Charles Comer, a vice president and technical analyst at Bache Halsey Stuart Shields Inc. Comer said many stocks "appeared to move ahead of themselves and higher than analysis should support" in encouraging short buying. "Then they move higher and you panic," he said. "If you're an institution you don't dare sell them."

Volume on the New York Stock Exchange was 98.6 million shares, down from yesterday's figure of 100.8 million, a day when most stocks were off and the Dow industrials fell by more than five points. The New York composite, closed at 79.80 up 1.45 with the average price up 60 cents.

Today's gains on the New York exchange were broad, with 1,221 stocks advancing and 436 declining. Only three stocks reached new lows, while 343 hit new highs. It was a strong day for computer- and technology-oriented issues, with International Business Machines Corp. the most active stock, jumping by 2 3/8 to 84 1/2. Warner Communications Inc. rose 2 3/8 to 51 5/8, Tandy was 2 5/8 to 42 1/2, Data General gained 4 7/8 to close at 36 7/8, and Lockheed rose 5 7/8 to 76 3/4.

Nationwide turnover in NYSE-listed issues, including trades in those stocks on regional exchanges and in the over-the-counter market, totaled 114.29 million shares.

Standard & Poor's index of 400 industrials rose 3.13 to 155.69, and S&P's 500-stock composite index was up 2.65 at 139.23.

The American Stock Exchange index was up 5.03, closing at 322.59. Volume rose from 8.8 million shares ygesterday to 10.6 million today and 421 stocks rose and 223 declined. The average share gained 21 cents.

In over-the-counter trading, the NASDAQ composite index was up 3.22 closing at 210.70.

Meanwhile, the dollar set a record in Milian of 1,442.05 lire, up from 1,436.05 Tuesday, after the government reported a 19.6 percent drop in industrial production.

Despite its weakness against the dollar, however, the lire has risen relative to European Monetary System float currencies.

Gold fell $15 in Zurich to $424.50 an ounce and dropped $15.50 in London to close at the same $424.50. In New York, however, gold rose to $432 at the close from $423 Tuesday. The New York Commodity Exchange settled the current contract at $432.40, up from $422.20.

Silver rallied even more strongly, jumping to $10.15 an ounce at the close, up from $9.92 Tuesday; it settled on the Comex at $10.17, up from $9.91.