On the back of stronger industry fundamentals, independent refiner Sunoco (NYSE: SUN) posted a second-quarter profit, joining peers Valero (NYSE: VLO) and Tesoro (NYSE: TSO), in addition to global integrated giants ExxonMobil (NYSE: XOM), Chevron (NYSE: CVX), and Royal Dutch Shell (NYSE: RDS-A), all of which have reported higher Q2 refining margins.

Sunoco's revenue of $9.59 billion was up 31% -- and well ahead of the average $8.25 billion analyst estimate. Earnings per share, meanwhile, came in at $1.20, trouncing a $0.47 loss in the year-ago period. That high-octane bottom-line performance also beat the Street expectation.

Unlike the previous quarter, in which Sunoco's nonrefining businesses carried the day, the refining and supply segment operated in the black for the first time since Q1 of 2009. Specifically, income from continuing operations totaled $86 million, contributing more than half of the $145 million in companywide net income. Management credited higher realized margins (which surpassed those of the company's benchmark), an improved utilization rate following facility maintenance, lower feedstock and utility costs, and the favorable effects of cost-cutting carried out in previous quarters.

Adding to the positive news, Sunoco's net debt-to-capital ratio has come down from 41% at the close of 2009 to 25% at the end of Q2. In the same period, cash on the balance sheet rose to $1.46 billion from $377 million. Basically, Sunoco looks well prepared for whatever bumps may lie in the road ahead -- and I expect many, especially if the U.S. consumer peters out and spare refining capacity fails to come down.

Perhaps the most exciting development, however, is management's recently announced decision to split its metallurgical coking business, SunCoke Energy, into a separate entity. The rationale here looks sound. As management has noted, the fuels and coking businesses are distinct operations that offer no meaningful synergies. Allowing the businesses to stand on their own should indeed unlock shareholder value. Consider, for instance, that Sunoco trades at a price-to-book ratio of 1.5 versus 10.3 for met-coal specialist Walter Energy (NYSE: WLT).

The spinoff is scheduled for the first half of 2011. I wouldn't recommend getting into Sunoco shares simply because of the pending transaction -- there are just too many volatile variables in the main refining business -- but for existing shareholders, this could be a nice reward for holding on through several quarters of pain.