If you were asked to pick a company at the beginning of earnings season that you thought would surprise investors with an earnings beat, Transocean (NYSE:RIG) was probably at or close to the bottom of the list. Ever since the glut of new rigs coming online started to flood the market with excess supply about 18 months ago, shares of Transocean have gone nowhere but down.

RIG Chart

RIG data by YCharts

But this past quarter the company posted much better than expected results. Let's go through a quick rundown of the numbers and look at how Transocean was able to do better than so many expected.

By the numbers
Transocean ended the second quarter with a per share normalized net income of $1.11 per share, which was more than double the consensus analyst expectations compiled by S&P Capital IQ that predicted Transocean's bottom line to be $0.51 per share. It was able to beat these expectations in part because it had higher revenue -- $1.88 billion, 10% higher than analyst expectations -- but it also improved its profitability by further cutting costs. Not only has retiring some of its older rigs cut operational expenses, but it has also lowered depreciation expenses as well. Overall, the retirement and stacking of out-of-work rigs saved the company about $130 million in operational and depreciation expenses this quarter alone. 

The most striking numbers for this quarter, though, was the major turnaround in its spending and cash generation. Total cash generated by continuing operations for the quarter was $1.3 billion, which was more than double what it had generated in the same quarter last year. On top of that, delayed deliveries of two of its rigs under construction and the near completion of two more helped total capital expenditures decline to a paltry $190 million. This helped the company build a war chest of cash to a rather impressive $3.77 billion.

A textbook turnaround
The past several months for Transocean's stock has been like a back waxing: extremely painful, but necessary to get rid of some unsightly parts of its company. In this case, it has been the retirement and scrapping of 20 rigs on the company's books that were more than 30 years old and were losing their serviceability on the open market. So, instead of trying to squeeze that last drop of cash from one more contract, the company decided it was time to part ways and focus more on its newer, more capable fleet. 

Despite the major asset writedowns and goodwill impairments that these moves have caused, it will cause two major improvements for the company:

  1. It will lower its operating costs as it no longer needs to spend money to keep those older rigs ready to drill.
  2. It will reduce the total amount of rigs looking for contracts on the market, which should eventually narrow the current oversupply of rigs on the market and lead to better dayrates for the remaining rigs awaiting work.

Transocean may not be completely done with this transformation -- it has about 18 more rigs that are more than 30 years old on the water -- but it has taken some of the bigger, more painful steps right up front. As these other old rigs come off contract, don't be surprised to see Transocean send them to the scrapyard as well to make room for its new rigs.

What a Fool believes
This past quarter may not be the pivotal moment in Transocean's turn in this down market, but there were small signs that it is starting to happen. Lowering capital expenditures from right-sizing its newbuild program and bringing down operational expenses from scrapping older rigs have done wonders for Transocean's profitability. The next thing that the company needs to focus on is determining which rigs it wants to keep around for the long haul and securing new contracts for them. It won't be easy considering current oil prices and the spending cuts from oil producers as of late, but it's a bit easier now that it has fewer rigs to worry about. 

Tyler Crowe has no position in any stocks mentioned. You can follow him at Fool.com or on Twitter @TylerCroweFool.

The Motley Fool has no position in any of the stocks mentioned. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.