Investors looked past the giant loss reported by General Motors ( GM) Wednesday and focused on its better-than-expected operating profit, revenue gains and improved outlook on lowering its bloated cost structure.

The world's largest automaker reported a second-quarter loss of $3.2 billion, or $5.62 a share, due to heavy charges related to its restructuring efforts. Last year, GM posted a second-quarter loss of $987 million, or $1.75 a share.

But excluding one-time charges totaling $4.33 billion, GM earned $1.2 billion, or $2.03 a share. That blew away Wall Street's forecast of an adjusted profit of 55 cents a share, according to analysts' average estimate reported by Thomson First Call.

"Conventional wisdom is that you can't turn a ship as big as GM around quickly," GM said in a statement. "We aim to prove that conventional wisdom wrong."

Shares of GM were recently up $1.47, or 4.8%, to $32.13. That jump added to GM's impressive return so far this year of 61%, which leads the Dow Jones Industrial Average.

It also provides GM's embattled CEO, Richard Wagoner, with some ammunition he can use to counter critics who routinely discussed the prospect of bankruptcy for the automaker throughout last year. Most recently, investors have speculated that activist investor Kirk Kerkorian's public support of the idea for an alliance between GM, Renault and Nissan was an attempt to ultimately replace Wagoner with Carlos Ghosn, the popular CEO of the other two companies.

Currently, GM is holding negotiations with Renault and Nissan about a potential deal, but the company declined to provide specifics on Wednesday about what form a partnership could take.

"We're going to spend the next 90 days trying to understand the industrial logic behind the deal and what synergies might actually come from this," said GM Chief Financial Officer Frederick Henderson on a conference call with analysts.

To watch Nat Worden's discussion with Farnoosh Torabi about GM's results, please click here .

Kerkorian, who owns a 9.9% stake in GM through his investment firm, Tracinda Corp., made a tender offer for up to 28 million shares of GM last May at $31 apiece. His investment has long been underwater, but Wednesday's stock gain put the Vegas mogul in the black for the first time since last fall.

Despite his success this year, Wagoner's turnaround can be at least partly attributed to public pressure from Tracinda, which added a representative, Jerome York, to GM's board earlier this year after calling for more aggressive action.

Since that time, GM offered its union-represented workforce one of the largest buyout offers in corporate history in an attempt to pare down its cost structure without provoking a labor dispute. The company said 34,410 employees accepted financial incentives to leave the company, putting GM ahead of schedule on its previously stated goal of cutting 30,000 hourly jobs by 2008.

In the second quarter, the attrition program weighed down GM's bottom line with $3.7 billion in charges, but the resulting cost savings also drove its operating profit and set the stage for higher-than-expected savings for 2006.

The automaker increased its structural cost-reduction target in North America to $6 billion for the year, up from $5 billion. That brings its total target for structural cost savings in North America to $9 billion on an average running-rate basis by the end of 2006.

The rest of the second-quarter charges came from other restructuring items, like a loss related to the planned sale of a 51% stake in GM's finance arm, GMAC. The company expects to close the deal with a private equity buyer, Cerberus Capital, in the fourth quarter. That should contribute to GM's cash pile, which grew to $22.9 billion at the end of the quarter from $21.6 billion at the beginning.

In the all-important auto market in North America, GM continued to struggle, but its performance was much improved. Excluding special items, GM lost $85 million in North America for the latest quarter, which marks an improvement of $1.1 billion over 2005's second quarter.

Meanwhile, GM's overseas operations, particularly in Asia and Latin America, provided significant upside and drove profitability. GMAC also helped results, with an $898 million profit for the quarter.

GM's total revenue rose to $54.4 billion from last year's $48.47 billion. Its automotive revenue was up 12% to $45.24 billion.

Stronger-than-expected results overseas boosted sales, but Henderson told analysts that its revenue per vehicle in North America rose due to sales of sport utility vehicles. Volume in North America, however, was flat, and GM's global market share declined to 13.8% from last year's 15.1%.

If GM can maintain its progress on improving the cost side of its business, the company still faces the daunting task of making its products more competitive in order to hold its market share steady and make up lost ground.

"We know we have to develop and build great cars and trucks to grow our business, and we're encouraged by the recent success of our newest vehicles, particularly in the U.S. market," Wagoner said. "Our newly launched vehicles will account for about 30% of our U.S. retail sales this year and grow to 40% next year."

While its turnaround is an ongoing project, GM's improved outlook marks a dramatic swing from the doom and gloom surrounding the company last year, when its shares dropped 48% as its sales and earnings collapsed. The improvement is especially impressive considering the current economic environment, with gas prices at record highs, interest rates rising and consumers feeling some spending constraints as a result.

"The operating environment is a little softer than what the industry anticipated and that has pushed incentives up this summer," said Henderson. "The lion's share of our revenue growth will come from Latin America and the Asia/Pacific markets."

He declined to predict when GM's North America unit will become profitable again, but he said the company has a "singular focus" on achieving that goal.

GM bonds, which were downgraded to junk status last year, moved upward on its earnings news Wednesday, evidence of the market's improving view of the company.

"My bonds were yielding 11.5% three months ago, and now they're yielding 10.25%," says David Feinman, managing director with Havens Advisors. (He owns GM and GMAC bonds, and his hedge fund has over $200 million in assets under management.) "That's still the best risk-reward deal that I see in the junk bond market. If you believe GM is not going out of business, you can invest a lot of money right now at 10.23% for the next 27 years. That's pretty good."