The nation's foreign trade deficit narrowed substantially last month, the government reported yesterday, as exports surged sharply, offsetting another rise in oil imports.

Commerce Department figures showed imports exceeded exports by $2.02 billion in October, down from $2.8 billion the previous month and $2.36 billion in August. The October red-ink figure was the smallest since July.

The improvement stemmed from two factors: The continued decline in the dollar has made U.S. exports less expensive for foreigners, while imports here are more costly. And the economic slowdown here has dampened demand.

Yesterday's figures showed exports up sharply, especially in manufacturing and agricultural products. Overall exports leaped 6.4 percent in October to $16.84 billion, following a scant 0.1 percent rise in September.

Imports rose by 1 percent last month to $18.86 billion after rising 2.7 percent in September and surging 8.3 percent in August. The volume of oil imports rose 4.7 percent, down from 6.1 percent in September.

The figures came as, separately, the Federal Reserve reported that the nation's basic money supply grew by $1.3 billion during the week that ended Nov. 21, following a $1 billion drop the previous week.

At the same time, business loan demand plunged by $411 million following a $364 million drop the previous week, continuing the dampening in the wake of the Fed's Oct. 6 credit-tightening actions.

Both changes were in line with the results sought by Federal Reserve policymakers, who are trying to slow the growth of the money supply and cool down demand for business loans to help stem the rapid inflation.

Yesterday's money supply figure was within the Fed's new quarterly targets, which call for an annual rate of growth of 4.5 percent. The rise left MI, the narrowest measure of the money supply, at $379.8 billion.

In still another report, the Labor Department said wages and salaries of Americans rose 2.1 percent last quarter, slightly more rapidly than the 1.9 percent jump recorded in the previous period.

The rise brought the increase in wages and salaries for the year that ended Sept. 30 to 7.7 percent, as measured by the department's new employment costs index. The figure doesn't include overtime pay or fringe benefits.

The narrowing in the trade deficit continued the improvement that began 18 months ago as the impact of the devaluation of the dollar made exports less expensive for foreigners and imports more costly here at home.

The October figures brought the trade deficit for the first 10 months of the year to $20.07 billion, compared to $25.4 billion for the same period in 1978. The deficit for 1980 is expected to be even lower.

The $2.02 billion red-ink figure was compiled on the department's traditional basis. On a newer measure, used more widely by other nations, the deficit for October was $3.12 billion, down from $3.944 billion in September.