A billion-dollar U.S. trade surplus with Western Europe in 1983 shifted dramatically last year, turning into a $14.1 billion deficit, the Commerce Department said in a new report on merchandise trade issued yesterday.

The new report on merchandise trade on a balance-of-payment basis, seasonally adjusted and excluding military trade of U.S. defense agencies, showed a record $107.6 billion deficit for 1984, 76 percent higher than the comparable figure for 1983.

Because of the omissions, the figures released yesterday were lower than the record $123.3 billion merchandise trade deficit reported Jan. 30.

The new report, which carried more details than last week's report, showed an 11 percent increase in U.S. exports, mostly to the neighboring countries of Canada and Mexico.

Exports to Mexico increased 40 percent, by $2.9 billion, which was considered especially significant because that country was a major buyer of U.S. manufactured products until 1982, when its debt crisis forced it to curtail its imports sharply.

It appears that Mexico has begun buying again, although its strong promotion of its own exports coupled with the strong U.S. dollar meant that it carried a favorable balance of trade with the United States.

The U.S. trade deficit with Mexico dropped to $6 billion last year, from $7.7 billion in 1983.

The Commerce Department reported a $22.9 billion merchandise trade deficit in the fourth quarter, a marked decrease from the $33.1 billion deficit in the third quarter. Imports decreased 11 percent while exports increased 2 percent.

Much of the decrease in imports was due to the second-half slowdown in the U.S. economy, the Commerce Department said.

The strong dollar was given as a major factor in the trade deficit by making foreign goods less expensive in the United States while the cost of U.S. products increased in overseas markets.

For the year, imports increased 25 percent, to $327.9 billion, while exports went up 10 percent, or $220.3 billion.

The capital goods sector provided the biggest increase in U.S. imports, up a substantial 46 percent, or $19 billion, depriving American machinery makers of the fruits of the nation's capital goods boom. But imports of consumer goods also increased substantially, by 33 percent, or $14.9 billion.

Although automotive imports jumped 28 percent, or $7 billion, the Commerce Department attributed most of the increase to higher prices. It said the number of auto imports increased by just 8 percent.

Japan, the major supplier of foreign cars to the United States, shipped bigger, more expensive autos to make up for the import quota that restricted the number of cars it could sell.

Export increases came in the sale of cars to Canada, up 27 percent, or $3.3 billion; electronic computers and parts, up 28 percent, or $3.1 billion; chemicals, up 14 percent, or $2.4 billion; and electrical machinery, up 13 percent, or $1.7 billion.