Virginia Gov. Charles S. Robb announced today that the state's surplus is approaching $160 million, but warned legislators against election-year spending ideas, citing expected cuts in federal aid and a potential downturn in the economy.

"We will be able to meet all of our needs and even some of our wants," Robb told the legislature's money committees at a joint meeting.

The governor attributed the surplus to larger-than-expected sales tax receipts, which should yield an additional $37 million this year, and a surplus of $81.2 million from the fiscal year that ended in June. In addition, the state has $4.7 million more in unspent funds and $37 million in a reserve account.

In his annual appearance before the General Assembly's finance committees, Robb said today he wants to increase the so-called "rainy day" reserve fund to $50 million because of uncertainties about the economy and federal aid. He also stressed that he believes the state's fiscal outlook is not as bright as it might appear and said corporate and utility taxes are expected to fall about $100 million below projections made in the state's biennial budget.

"The presents under the state's fiscal tree this year will not be as numerous or as large as many had hoped or perhaps envisioned," Robb said. "Neither, however, is my mesage that of Mr. Dickens' Scrooge, although I'm not about to abandon my reputation for frugality."

The Virginia legislature meets Jan. 9 to consider changes in the state's $15.9 billion biennial budget for 1984-86 and other issues.

Robb, who will not propose any spending programs until his State of the Commonwealth address next month, has indicated that he will recommend increased spending for education and the state's troubled prison system.

The relatively robust financial picture as Robb heads into the last year of his term is in sharp contrast to the state's finances during his first three years in office. During that period he ordered budget cuts of more than 12 percent for most state agencies because of the economy and imposed a freeze on merit pay for state employes that remains in effect.

Despite the improved picture, Robb said today that efforts to reduce the nation's massive federal deficit could result in a loss of federal funds for Virginia. The Reagan administration has proposed cuts of $34 billion in various programs that could reduce funds sent to Virginia.

In addition, the U.S. Treasury Department has said that the nation's state governments are in better fiscal condition than the federal government and that many are expected to show surpluses. A Treasury spokesman said today that its national projection was not broken down on a state level and declined to comment on the size of Virginia's surplus.

A spokesman for Robb, one of several governors who questioned the Treasury's projections, said today that the federal government has not taken into account the belt-tightening states have done the last few years, during which some programs were curtailed or abolished.

"The nation's governors, both Democratic and Republican, made tough choices to cut programs and personnel and raise taxes, all of which are politically difficult," said George M. Stoddart, Robb's press secretary. "At the federal level, those decisions haven't been made."

Robb also noted that local governments will share an additional $21 million from the higher sales and alcoholic beverage taxes the state is collecting. Part of the state's ABC taxes and one fourth of its 4 percent sales tax are allocated to localities for education.