Hard to believe, but just four years after crashing in the Great Recession, stock prices are hitting record highs. The surging market not only reflects an improving economy, but also helps drive its improvement. This is one of the best reasons to be optimistic about the country's prospects.

The stock market's resurrection has been impressive. Major indexes have nearly doubled since the worst of the downturn. The market is near where it was just before the start of the housing crash, and this time it stands on more solid economic ground.

Corporate profits, the basis for valuing stocks, have never been higher. U.S. businesses did a marvelous job of raising productivity and lowering costs during the recession, and firms are now highly competitive in global markets. Lower energy costs and a softer U.S. dollar add to their market strength. Companies are also flush with cash, and they have very low debt loads.

The Federal Reserve clearly wants higher stock prices to help lift the economy. The central bank has committed to buying trillions of dollars in U.S. Treasury bonds to push interest rates close to record lows. That makes it less attractive for households to put their savings into Treasuries or bank certificates of deposit. While stocks are riskier, they look enticing by comparison.

Stocks also look better because threats to the economic recovery have faded. Despite the banking crisis in Cyprus, the eurozone seems much less likely to crack up today than it did a year ago. The European Central Bank, the eurozone's version of the Federal Reserve, has signaled an unshakable commitment to preserving the currency union, taking a series of extraordinary measures that have lifted the markets' confidence.

America's fiscal problems also look much less daunting than they once did. Only a couple of years ago, lawmakers appeared ready to trigger a default on U.S. Treasury debt, and only a few months ago, Washington threatened to drive us over a fiscal cliff. But the politics have clearly changed, and neither party seems likely to threaten a government shutdown or a debt default. Even the rancorous debate over government spending cuts and tax increases should soon recede to the inside pages of the newspapers.

Investors can once again smile as they watch cable business shows and linger over their 401(k) statements. Even though house prices haven't recovered much, the net worth of American households is as high as it has ever been. Consumers who realize this are spending more, even amid rising taxes and gasoline prices. This wealth effect is typically small, but at times like this, it can provide a meaningful boost to the economy.

Business executives are also feeling much better. Stock prices are like report cards, and managers are receiving A's for the first time in years. This will help them finally shake off the nightmare of the recession and begin to hire and invest more aggressively.

Stock prices are thus a good leading indicator for the broader economy. True, they aren't foolproof, especially in predicting downturns; the economist and Nobel laureate Paul Samuelson once quipped that the stock market had predicted "nine out of the last five recessions." But it would be very unusual for the stock market to be doing as well as it is without the economy following suit.

The scars of recent years have some worrying that the stock market has come too far too fast and is now overvalued, especially given the Fed's unprecedented monetary policy. But there is scant evidence to support such concerns. Price-earnings ratios, which are among the best ways to gauge whether stocks are valued appropriately, are still near their long-run averages.

All this good news does come with caveats. For one, the benefit of rising stock prices accrues to a small proportion of households. Only half of U.S. families own any stock at all, and only about a third of households receive a significant financial boost when prices are rising. The distribution of wealth is highly skewed, and a surging stock market makes it more so.

It is also important to remember that the stock market never moves in a straight line; stock prices rise and fall. So it would be sensible to assume that they will take a significant step back in the not-too-distant future. Investors should have sufficiently strong stomachs and long-enough investment horizons to endure these inevitable swings.

But looking beyond such volatility, stocks are sending a strong and hopeful signal: Our economy is on its way back.

Mark Zandi is chief economist of Moody's Analytics Inc.

He can be reached via help@economy.com.