After suffering through 2008 and the first quarter of this year, stock bulls finally have something to crow about. In the second quarter, the S&P 500 rose 15%, turning in its best performance since the glory days of the second quarter of 1998. Are these gains sustainable?

Gainers and laggers
As the following tables demonstrate, some large-capitalization stocks turned in huge numbers, while others were left behind in the rally.

S&P 500 Gainers (among top 5%)

Company

Q2 2009 % Return

Cyclically Adjusted P/E Ratio*

Ford Motor (NYSE:F)

130.8%

--

Bank of America (NYSE:BAC)

93.5%

4.6

Dow Chemical (NYSE:DOW)

91.5%

6.2

Capital One Financial (NYSE:COF)

78.8%

5.8

Source: Capital IQ, a division of Standard & Poor's; author's calculations.
*Price divided by average earnings-per-share over the prior 10 years. Note that this P/E differs from the one cited for the S&P 500 below; the latter uses inflation-adjusted earnings.

S&P 500 Laggers (among bottom 5%)

Company

Q2 2009 % Return

Cyclically-Adjusted P/E Ratio

Bristol-Myers Squibb (NYSE:BMY)

(7.3%)

14.5

Monsanto (NYSE:MON)

(10.5%)

25.0

Best Buy (NYSE:BBY)

(11.8%)

11.8

Source: Capital IQ, a division of Standard & Poor's; author's calculations.

Interestingly, despite significant stock price advances, the P/E ratios of our gainers remain substantially lower than the ones for our laggers. In the case of Bank of America and Capital One Financial, this reflects uncertainty concerning additional losses and normal profitability in a post-crisis economy.

What's the market worth?
At yesterday’s close of 919.32, the S&P 500 is valued at 15.75 times the average of its prior-10-year earnings, which is fractionally below the long-term average of this P/E ratio (16.3). That suggests that stocks are approximately fairly valued.

Bear in mind, however, that if the "new normal" growth rate in the economy is less than 2%, this will constrain profit growth, which in turn justifies a lower multiple. In that context (and for a couple of other reasons), I tend to believe that stocks are actually slightly overvalued, leaving them susceptible to a correction in the short term. (The average annualized growth rate in real GDP between 1929 and 2008 is 3.3%.)

Outlook: Fair, with pockets of real value
On a longer-term basis, stocks look moderately attractive right now (which may be good enough at a time when the alternatives -- government bonds, for example -- look singularly unattractive). Furthermore, despite the surge in stock prices since the market's March 9 low, pockets of genuine undervaluation persist. I recommend concentrating on 1) high-quality businesses and 2) financials. In the latter case, the uncertainty over appropriate valuations in this environment has created significant opportunity, while financial meltdown is now longer a threat.

Looking for specific names? Morgan Housel highlights three high-quality companies that are still cheap.

More Foolishness:

Take a hint from Warren Buffett's recent investment in preferred shares with fat yields: In this market, dividends will be a big part of future returns. The team at Motley Fool Income Investor can show you how to build -- and manage -- a portfolio of stocks that pay a growing dividend. To find out their top five recommendations for new money now, take advantage of a 30-day free trial today.

Alex Dumortier, CFA, has a beneficial interest in Best Buy, but not in any of the companies mentioned in this article. Best Buy is a Motley Fool Stock Advisor recommendation and a Motley Fool Inside Value pick. The Fool owns shares of Best Buy. Try any of our Foolish newsletters today, free for 30 days. The Motley Fool has a disclosure policy.