Two utility stocks were near the top of the S&P 500 list last quarter. Image: katsrcool, Flickr.

The S&P 500 (SNPINDEX:^GSPC) finally suffered a long-awaited correction during the third quarter, as investors worried about whether the U.S. economic recovery would be able to survive an end to the most favorable monetary policy available from the Federal Reserve. Even though nearly three-quarters of S&P 500 stocks posted declines between July and September, there were still plenty of winners in the market, and a few managed to post gains of more than 30% for the quarter. Let's take a closer look at these winners to see what was behind their successful season.

3. AGL Resources, up 33%
Merger and acquisition activity is often a key driver for stocks that soar, and that was a common theme for the stock market's winners this quarter. For gas utility company AGL Resources (NYSE: GAS), the good news came in late August when the company said that utility giant Southern Company (NYSE:SO) would buy AGL for $66 per share. The combination will bring together a wide network of electrical and natural-gas utility services across nine states, with an estimated 9 million customers covered under the combined company's umbrella.

Going forward, Southern Company shareholders will be the ones to benefit from AGL's future success, with the all-cash deal giving existing AGL investors no direct ability to share in further gains. But with utilities having been under some pressure from the threat of rising interest rates, AGL shareholders might end up feeling like they got out at just the right time.

2. Cablevision Systems, up 36%
Another area that has seen considerable consolidation has been the cable television industry, and the latest company to show up on the chopping block was Cablevision Systems (NYSE: CVC). The company agreed to a deal with European telecom company Altice under which Cablevision shareholders will receive $34.90 per share in cash. Due in large part to the influence of the Dolan family, which owns a huge block of Cablevision shares, the deal has already passed the threshold in terms of needing no further approval from other Cablevision shareholders.

For Altice, the move is just the latest in a series of aggressive acquisitions throughout the world, and those following the stock expect that the company will seek to use cost-cutting measures to boost profits at Cablevision. Altice founder Patrick Drahi has said that he expects the U.S. market to provide as much as half of the company's overall global revenue, and if approved, the Cablevision deal will fit well with that goal. Again, though, existing Cablevision shareholders have no direct ability to share in Altice's possible success because of the all-cash nature of the deal.

1. TECO Energy, up 50%
Finally, TECO Energy (NYSE: TE) was the big winner in the S&P 500 for the quarter, jumping 50% in two waves. The first came in July when the company said it would put itself up for sale. Then, in September, the company announced a final deal from Canadian utility Emera that will pay TECO shareholders $27.55 per share in cash.

TECO has an unusual mix of businesses under its corporate umbrella, with two widely spaced geographical areas it serves. Serving electric and natural gas customers in Florida is arguably its primary business, but the company also has more than half a million customers in New Mexico to whom it distributes natural gas. For Emera, which serves eastern Canada as well as the state of Maine and the island of Barbados, adding some more exposure to different geographical areas seems to fit well with its overall business strategy.

M&A activity can give investors a quick payday, but it can still be bittersweet for those who continue to believe in the long-term prospects of the businesses that are being acquired. Nevertheless, investors in these three stocks have the option of taking their cash and buying shares of the acquiring companies on the open market. If you continue to believe in their eventual success, then doing so can be a way to build on your gains from their mergers.