Click for more market data.
NEW YORK (CNNMoney)
First Solar was the best performing stock among the S&P 500, gaining more than 65% over the past three months.
It's a remarkable rebound for the leading maker of solar panels, which saw its stock fall 12% in the first quarter.
First Solar (FSLR) wowed investors in April with a surprisingly bullish outlook for the year. The stock shot up 43% in one day, after First Solar said it expected profits to be 28% above previous forecasts this year on healthy sales growth.
The solar industry has been in a slump as low-cost imports from China have depressed prices. But solar panel prices have stabilized and First Solar said demand is ramping up.
First Solar wasn't the only underdog to make a comeback.
J.C. Penney (JCP, Fortune 500) shares gained more than 12% during the quarter, recovering about half of their first quarter losses.
The retailer ousted CEO Ron Johnson in April, after his controversial turnaround plan failed to show results. J.C. Penney publicly apologized for the changes, and ran an ad on its YouTube channel that practically begged customers to come back.
Related: Top hedge fund manager bets on a return to normal markets
In business for more than 100 years, J.C. Penney has been swimming in red ink as it struggles to compete with online retailers. But the company has been strengthening its finances in an effort to mount another turnaround. It scored a $1.75 billion loan from Goldman Sachs (GS, Fortune 500) in April.
Other top performers in the quarter include popular momentum stocks, such as GameStop (GME, Fortune 500), Micron Technology (MU, Fortune 500) and Best Buy (BBY, Fortune 500).
Best Buy has also been on a turnaround kick, cutting costs and closing under performing stores. Investors have welcomed the moves, sending shares up 26% in the quarter, despite a disappointing sales report in May.
It was also a good quarter for health insurance companies. Shares of Aetna (AET, Fortune 500), WellPoint (WLP, Fortune 500) and Humana (HUM, Fortune 500) all rose by more than 23%.
Golden parachute? Mining companies were among the worst performers in the quarter as prices of precious and non-precious metals plunged.
Shares of Alpha Natural Resources (ANR, Fortune 500) and Newmont Mining (NEM, Fortune 500) fell more than 30%. Iron Mountain (IRM) and Freeport McMoRan (FCX, Fortune 500) also suffered double-digit losses.
Investors have been dumping mining stocks as gold prices plunge.
Related: Gold plunges to two-year low
The precious metal is down 25% this quarter, falling below $1,200 an ounce this week for the first time since August 2010. The largest gold-backed ETF, the SPDR Gold Shares Trust (GLD), lost nearly 24% during the past three months.
While the sell-off in gold has caught the most headlines, mining stocks have also been hurt by the falling price of copper.
Copper prices plunged nearly 12% in the second quarter as demand from China slowed and supplies increased.
A number of energy companies were also hit hard.
Marathon Petroleum (MPC, Fortune 500) shares are down more than 20% for the quarter, after gaining 42% in the first quarter. The company has been playing catch-up on the boom in domestic energy production, and is exposed to a slowdown in emerging market demand.
Peabody Energy (BTU, Fortune 500), which specializes in coal mining, and gas station operator Valero (VLO, Fortune 500) were also big losers in the quarter.
First Published: June 28, 2013: 12:44 PM ET