It was an odd summer for equity markets, as investors shrugged off upbeat corporate earnings and sold stocks, fretting instead about the U.S. slipping into another recession and the ongoing debt crisis in Europe. Things got odder in September, when the S&P 500 hit an unusual milestone: It yielded more than the 10-year Treasury note. That's only happened 20 times since 1953, according to Sam Stovall, chief investment strategist of Standard & Poor's. His research shows that the S&P 500 climbed an average of 20% in the following 12 months. He observed that that was the good news. "The bad news is that past performance is no guarantee of future results," he wrote in a report.

To temper the good news further, investors should realize that the S&P 500 did not rocket higher every one of the 20 times it out-yielded Treasuries. It rose 16 of 20 times, or 80% of the time. Stovall attributed investors' historic enthusiasm to the love of a bargain. At the end of many of the quarters when stocks out-yielded bonds, investors went on a shopping spree. The last time in recent memory was in March 2009, when investors spotted the "for sale" sign and sent the S&P 500 up 20% the following year.

But there is a bit more good news. "Close counts in both horseshoes and high relative stock yields," Stovall says. In the 19 times that the S&P dividend yield was within one percentage point of the yield on the 10- year Treasury note, the stock index climbed an average of 11% within 12 months. The batting average for that phenomenon is similarly encouraging, with the S&P gaining 15 of the 19 times, or 79% of the time. That compares with the average price change for the S&P 500 of 8.4% for all rolling 12-month periods since 1953. Although there are relatively few observations of the times stocks did not rally in these circumstances, one of them, 1956-1957, looks similar to today. "The market was certainly going through gyrations because of worries about the U.S. economy," Stovall notes.

Two more market developments provide reason for remaining optimistic, however. Both offer examples of a silver lining. The S&P 500 fell 7.2% in the week ended August 5.

Since 1950, in the 29 other times the index fell by 5% or more in a single week, it was higher a year later by a median 18.5%. The gain happened 77% of the time.

The second is in the realm of consumer confidence. The University of Michigan consumer sentiment survey in August recorded the worst rating since 1980, below 60. (The higher the number, the more optimistic consumers are.) The last 10 times the survey fell below 60, the S&P 500 was higher by an average of 21% in the following 12 months. It rose in 8 of 10 observations. It makes sense, given the old adage "If you hear it's a boom time, get out; if you hear gloom time, get in."

Yet despite the healthy historical batting average behind market gains, Stovall says he's not actually as optimistic as these statistics indicate he could be. He has set his price target higher than the market is now, but says, "I'm still very worried about us possibly slipping back into a recession."

S&P's economist Beth Ann Bovino puts the likelihood at less than 50%, but Stovall described the recent U.S. economic data as "discouraging."

Stovall is also worried about the continuing sovereign debt drama unfolding in Europe. "While this study encourages me to maintain a neutral exposure to equities, my worries about the macro outlook globally causes me to recommend that investors focus on larger-cap, higher-quality dividend-paying stocks over more aggressive cyclical or smaller-cap issues," he says.

Stovall suggests investors look to defensive sectors. But he adds that even if next year is the first of a new bull market, the rising tide will lift all boats. Winners will include not only cyclical sectors that do well early in a market cycle, but also defensive plays like food, beverage and tobacco.