Stock and bond prices rose sharply today, sparked by a favorable government report on inflation, new declines in the prime rate at major banks and further evidence that the recession is spreading.

The Dow Jones industrial average of 30 key New York Stock Exchange issues soared 18.45 points to 870.24. It was the biggest one-day increase in this closely watched average since Oct. 30, when it climbed 19.60 points.

The bond market, which until a massive selloff on Monday had been rallying consistently for a month, recovered today. Bond prices declined about $25 for each $1,000 of face value Monday, but today bond prices rose about $30, according to Nicholas Marrone of the Bank of New York.

Short-term interest rates declined as well. Rates on one-month certificates of deposit--a security banks issue to raise money to lend to customers--fell from about 11.9 percent late Monday to 11.7 percent today.

Jerry Hinkle, the chief stock trader at the brokerage firm Sanford C. Bernstein & Co., said investor psychology was aided at the start of trading by the Labor Department report that consumer prices had risen 0.4 percent in November for a compound annual rate of 4.9 percent. Most analysts had expected an increase of at least 0.6 percent for the month.

A number of major banks lowered their prime lending rate to 16 percent, while Chase Manhattan, New York's second biggest, reduced its key business lending rate to 15 3/4 percent.

But Hinkle said the catalyst to stock traders was an afternoon report by the Commerce Department that durable goods orders fell 8 percent in October. The sharp decline in new orders indicates that the recession will be more severe than anticipated.

Although a severe recession is bad news for corporate profits, it will help keep the rate of inflation down and contribute to a continued decline in interest rates, analysts have forecast.

"We're working to a classic script here," said Hinkle. Stock investors appear to have discounted the decline in profits and are looking to reduced inflation and the prospect of a strong recovery beginning by mid-1982, he said.

Stock prices increased steadily most of the day, and by 2:30 p.m., when the Commerce Department released it report about the decline in durable goods orders, the Dow average was up about 9 1/2 points. It surged another 9 points in the last hour-and-a-half of trading.

Similarly, Marrone said, bond prices jumped about $20 in the 15 minutes following the Commerce Department report.

The stock market rally was broad-based, with about 1,000 stocks on the NYSE closing higher than they did Monday and about 500 declining in price. The Big Board's own broad index was 71.85, up 0.94 points. On the American Stock Exchange, the overall market index gained 3.49 points to 321.54. The National Association of Securities Dealers overall index for the over-the-counter market gained 1.03 points to 199.04.

Nearly 53.4 million shares changed hands on the New York exchange, up from 45.25 million on Monday. Composite volume of NYSE issues traded on all exchanges and over the counter jumped to 61 million shares from 51 million traded Monday. Amex volume rose to 5.3 million from 4.3 million shares.

The biggest gainer in the Dow industrials was U.S. Steel Corp., whose price jumped $2.50 a share to $30. U.S. Steel, which is bidding against Mobil Corp. for control of Marathon Oil, was the most actively traded stock on the NYSE. About 1.24 million shares of U.S. Steel were bought or sold today on the Big Board alone and additional shares were traded on the Pacific Exchange floor and other markets.

Mobil said today it had bought slightly less than $15 million of U.S. Steel stock, apparently as part of a strategy to win control of Marathon, and said it would file appropriate notices with the federal government before it makes additional purchase of the steel giant.

Marathon stock also was heavily traded today, climbing $2 a share to $106.50 as Mobil rose 62 1/2 cents to $26.50 a share.

Mobil is offering $85 a share for 40 million shares of Marathon, about 67 percent of the Ohio oil company's outstanding stock. U.S. Steel, which was courted by Marathon as a "white knight" rescuer, said it would pay $125 a share for 30 million Marathon shares, about 51 percent of the company, and would then exchange $100 U.S. Steel notes carrying an interest rate of 12 1/2 percent for each of the remaining shares of Marathon.

Mobil had not sweetened its $85-a-share offer as of late today.