Looking back at the past three months, the stock market has put on an even better fireworks show than many of us saw over the weekend. Among plenty of winners, though, one type of investment unexpectedly found itself ranking behind many of its peers -- and smart investors need to learn a valuable lesson from its temporary failure.

Investment research firm Lipper recently released mutual fund returns for two dozen fund categories that it tracked over the first half of 2009. Among the best performers were the following:

Category

1st-Half 2009 Return

Latin America

44.5%

China

37.2%

Science & Technology

24.6%

Basic Materials

22.9%

Gold

18.0%

Source: Lipper.

None of those results should come as a great shock to anyone who's followed the stock market during the first part of the year. In Latin America, companies like MercadoLibre (NASDAQ:MELI) and Petroleo Brasileiro (NYSE:PBR) have ridden the emerging-markets wave higher, as global investors look for places where economies will either continue to grow or at least not drop as far as those in the developed world. China's Baidu (NASDAQ:BIDU) more than doubled during the first half of 2009, and many other Chinese stocks put in impressive results.

Moreover, the companies that produce what those economies need to sustain their growth have also thrived. Miners like Rio Tinto (NYSE:RTP) and BHP Billiton (NYSE:BHP) are cashing in on continuing demand from China and the rest of Asia, despite prices that are down substantially from last year's peak.

And although tech stocks like Apple (NASDAQ:AAPL) and Research In Motion (NASDAQ:RIMM) have plenty to gloat about closer to home, their long-term success will almost certainly involve expanding their international market share.

Is indexing dead?
The main surprise on the list, however, comes from all the fund categories that managed to top the S&P 500 index. Large-cap core funds rose an average of 4.8%, outpacing the S&P 500 by nearly two percentage points. Small-cap and mid-cap funds did even better, putting in returns of 6.3% and 9.2%, respectively -- and those returns handily outpaced those of their respective benchmarks.

Skeptics may point to this victory by active fund managers as evidence that blindly following indexes is never the best course for investors to take. Yet instead of celebrating active funds' short-term triumph over index funds, you should focus on two key points.

First, you can't draw any firm conclusions from looking solely at a six-month performance record. Over longer periods of time, a good majority of active fund managers have trailed their benchmarks on average -- as you might expect from an investment vehicle that incurs greater costs that get passed on to investors in the form of higher fees.

More importantly, though, results like these only reflect the performance of the average fund manager -- and that's not who you ought to be giving your attention to. Given that so many fund managers fail, in order to have a chance at succeeding with an active fund, you really have to focus on the top managers.

For instance, well-known value manager Bill Miller of the Legg Mason Value Trust has managed to recover strongly so far in 2009, after his string of 15 consecutive years beating the S&P ended disastrously with investment miscues in the financial sector.

Be smart
Given how badly most stocks performed in 2008 -- especially those in categories that top the list so far in 2009 -- it's little wonder that they've bounced so high so quickly. Clearly, you shouldn't grow accustomed to such huge returns, or expect them to come again in the near future.

The winners among mutual fund categories during the first half of the year should remind you how important it is to include a diversified mix of investments among your fund portfolio. Leaving out less popular niche areas like emerging markets or materials stocks could have cost you plenty during the rally.

Since it's impossible to predict with any certainty exactly which category may be tomorrow's big winner, the best strategy for most investors is to own some of everything. That way, you're sure always to have at least some fireworks in your portfolio.

For more on smart investing with mutual funds, read: