Every once in a while the stock market gets a chance to demonstrate that it is more than some sort of economic sideshow.

Now is one of those times. As the Standard & Poor's 500-stock index hit a four-year high last week, news reports served up evidence that stocks were helping to relieve some of the big economic problems of the day.

On one of those problems, the U.S. budget deficit, the gap has narrowed lately to a White House projection of $333 billion for the fiscal year ending Sept. 30 from a previous forecast of $427 billion, thanks to a surge in tax receipts.

"There has not been a surge in withheld taxes, or taxes deducted from payrolls," the Financial Times reported. "The big rise in individual tax revenues has been in non-withheld taxes, such as capital gains taxes, in large part the result of stronger economic growth and stock market gains last year."

That's only the beginning of what a robust stock market can accomplish. It can fatten balances in pension plans and 401(k) accounts, taking some of the menace out of what many describe as a developing retirement crisis.

No matter what is done with government programs such as Social Security, it's hard to imagine a happy outcome to this long-running drama without healthy financial markets.

In the more immediate future, rising stock prices can also provide a morale boost to encourage consumers to keep hitting the malls.

"The current, rather mild U.S. recovery has been driven by asset appreciation/consumption and not employment or capex [capital expenditure] growth," writes Bill Gross, manager of the largest of all bond funds, the $86 billion Pimco Total Return Fund, in a Web site commentary. "Future growth is dependent on additional asset appreciation in real estate and stocks if Asia continues to absorb much of our investment and many of our jobs."

It's a common practice to pooh-pooh stock-market gains as a source of sustained progress because the good times in stocks come in unpredictable fits and starts.

This view puts too much emphasis on short-term fluctuations. Typically, the juiciest capital gains are amassed over multiyear periods.

That explains why capital gains distributions by mutual funds were much higher -- $55 billion, according to the Investment Company Institute -- in 2004 than they were in 2003, when they totaled $14 billion. Note that the S&P 500 gained a relatively modest 10.7 percent in 2004, including dividends, after jumping 28.4 percent in 2003.

True, capital gains may swing wildly from one year to the next. Funds' gains distributions tumbled to just $16 billion in 2002 and $14 billion in '03 from $316 billion in 2000.

Still, by my math, over the last nine years they have averaged $129 billion a year as the S&P 500 has averaged a 9.4 percent gain.

To judge from these numbers, capital gains tax receipts have plenty of room to increase from their recent levels as long as the economy performs well enough to keep the stock market climbing at something like a 9 percent average annual rate, which is right around its historic average.

In other words, if policymaking authorities give the stock market what it wants, it is likely to repay them handsomely. What the stock market wants, most of all, is real economic growth that translates into higher corporate earnings.

Many threats exist to this growth. "Recent asset appreciation has been set ablaze by several fiscal/monetary pumps," including tax cuts and low interest rates from the Federal Reserve, Gross writes. "If the asset pumps run dry, the inevitable path of the U.S. economy will reflect slow growth at best, and recession as a realistic alternative."

Therein lies the strong and continuing relevance of the stock market for the economy at large. How it performs in the coming months and years will be not only a result of what happens in that broad economy, but also a cause.