Toyota (NYSE: TM) hasn't had a great couple of years. The Japanese auto giant endured a series of management missteps that culminated in a prolonged, embarrassing quality scandal -- and just when things were starting to settle down, the March earthquake and tsunami did major damage to its supply chain.

But despite all that, Toyota has kept rolling. While the company lost money in its most recent quarter, it surprised many by losing less than expected -- and by presenting an optimistic outlook for the rest of the year.

That resiliency is impressive. With Toyota's stock trading at its lowest levels since November, is it impressive enough to make the company a buy?

A rough and costly few months
Toyota was just one of several global giants to suffer production problems in the wake of the March disaster in Japan. But Toyota's problems were pretty major: Production of key bread-and-butter models like the Corolla and Prius was disrupted for months in factories around the world, as a result of sudden, prolonged shortages of a few hundred critical parts.

That production is starting to come back up to speed, but Toyota has lost a lot of sales in the interim. While the number of lost sales may ultimately turn out to be less than many expected when the disaster first struck, thanks to the enduring loyalty of Toyota's core customers, key competitors have benefited.

For instance, many U.S. customers did try (and buy) the suddenly very-competitive small cars from Ford (NYSE: F), General Motors (NYSE: GM), and Hyundai (OTC: HYMTF), all of which have seen gains since the beginning of spring. Midsize sedans show a similar picture, where sales of solid entries from each of those three makers led those of Toyota's Camry, the category's longtime standard-bearer, as Toyota struggled to get back on its feet.

The hit has been substantial, and not just to the company's bottom line. Toyota's share of the all-important U.S. market fell to just 12.3% in July, versus about 16% a year earlier.

The game is about to change, but will profits rise?
Toyota now expects to be back up to full production capacity in September, and executives have signaled that the company will mount a major marketing-and-incentives campaign to regain that lost share. Toyota's history gives reason to think the effort will be successful -- at least in terms of total sales and market share.

The question is, how will profits fare? The lost production has been a drag on earnings, but so has the value of the yen versus the dollar. Toyota Senior Managing Officer Takahiko Ijichi recently estimated that the yen's rise has cost the company about $4,000 in lost profits for every vehicle sold.

That seems unlikely to change soon. Meanwhile, Toyota's long-held position of product dominance is facing its harshest challenge in years. The company's key products are still competent entries, but like those from rival Honda (NYSE: HMC), they're starting to look stale next to well-done models from competitors like Ford and Hyundai -- models that are giving Toyota a run for its money in the all-important Consumer Reports ratings as well.

Automakers without class-leading products ultimately have to resort to incentives (discounts) to keep sales up. That in turn cuts margins, and that in turn constrains the investments that can be made in the next generation of products -- which are then, again, less competitive. This is the cycle that clobbered Detroit for years, and it's a problem that the Detroit automakers have worked hard to escape.

It's a cycle that Toyota should be savvy enough to avoid. But a return to clear product dominance probably isn't in the cards, and that makes the stock hard to recommend even at current levels. The early word on Toyota's next-generation Camry is that it's evolutionary, rather than revolutionary -- more a tweak of the current good-but-not-brilliant product than a major step forward.

That's an approach that has worked fine for Toyota in the past. But in this new competitive world, it may not be enough.

Worried about the impact of higher energy prices? You're not alone -- but here's the good news: It's not too late to profit. In the new special report," 3 Stocks for $100 Oil ," expert Motley Fool analysts name three outstanding companies that should benefit handsomely from rising oil prices. The report is available free of charge for Fool readers -- and here's your chance to get instant access.