United States' transactions with the rest of the world, other than long-term capital flows, were virtually in balance in 1979, despite an $18 billion increase in the nation's bill for oil imports, the Commerce Department reported yesterday.

This strong balance-of-payments position, coming at a time when most other industrial nations, including Germany and Japan, are slipping into large deficits, is one reason for the recent strength of the U.S. dollar on foreign exchange markets, some analysts said.

The new figures are for the balance on current account, which includes merchandise trade, services, tourism, earnings on direct investments abroad, remittances and certain other payments.

The current account was in deficit last-year by only $317 million, compared to a $13.5 billion deficit for 1978. That improvement occurred even though the merchandise trade deficit dropped only from $33.8 billion in 1978 to $29.5 billion last year.

While many government officials and business executives continue to complain about the "poor" export performance of the United States, other analysts noted that the country managed to absorb the $18 billion increase in oil-costs and still reduce the merchandise trade deficit.

Meanwhile, the much less noticed service transactions surplus, which the United States has been running for years, rose $9.4 billion, to a total of $34.8 billion. That jump, the department said, was "due to exceptionally large receipts of income on U.S. direct investments abroad, primarily from petroleum affiliates."

Most economic forecasters, including those in the Carter administration, expect the U.S. current account deficit to widen again this year as higher oil prices continue to take their toll, both in terms of a bigger import bill here and through slower economic growth abroad, which will reduce the market for American exports.

That process apparently began in the fourth quarter of last year as the current account shifted in a $900 million deficit from the $1.1 billion surplus in the third quarter, the department said.

Among the capital account transactions, which are not part of the balance of current account, the department said claims on foreigners reported by U.S. banks rose $7.3 billion in the fourth quarter, compared to a $17.1 billion jump in the previous quarter.

A drop in capital flows from the United States to Europe, partly a consequence of the sharp increase in interest rates here relative to those in Europe, was largely responsible, the department said.

Foreign official assets held in the United States fell by $1.5 billion, compared to a $5.7 billion rise in the previous three months. The decrease was more than accounted for by substantial sales of dollars by Japanese authorities to support the value of the yen. To get the necessary dollars, the Japanese cashed in U.S. securities.

Meanwhile, members of the Organization of Oil Exporting Countries were increasing their holding of U.S. securities as their current account surpluses began rising in response to higher oil prices.