After peaking in the 1950s, General Motors (NYSE:GM) began a long descent at the hands of Toyota (NYSE:TM) that bottomed out in 2009 when GM filed for bankruptcy. As GM was stumbling, Toyota saw an opportunity to grow much faster and then lost its own way. Now, after emerging from bankruptcy in 2010, GM is up while Toyota slumps. Should you buy either stock?

Recent financial performance suggests that GM is definitely the winner here — with a net profit margin of 3.5%, higher than Toyota’s 2.5%. But GM is also now a much smaller company: In 2010, GM’s sales totaled $136 billion with $4.7 billion in profit, while Toyota’s last 12 months’ sales were $242 billion on which it earned $6.1 billion.

And GM is poised to retake the top spot in world vehicle market share. According to Bloomberg, GM’s Malibu is getting better reviews than the formerly GM-beating Toyota Camry. Moreover, GM is gaining share in China — expecting to sell 5 million vehicles there by 2015 — double its current total. Meanwhile, the recent earthquake in Japan has forced Toyota to cut vehicle production by 500,000.

But both companies have suffered from management problems. As I noted in May 2009, GM failed for five reasons: bad financial policies, uncompetitive vehicles, ignoring the competition, failure to innovate and managing in the bubble. And after its restructuring and emergence from bankruptcy, it looks like it has changed for the better.

Meanwhile, Toyota has struggled. As I wrote in February 2010, Toyota saw GM’s weakness nearly 10 years ago as an opportunity to grow much faster to overtake GM. But in focusing on that goal, Toyota uprooted itself from the very strengths that enabled it to beat GM — specifically, its system of mentoring young engineers that ensured a stream of ever-higher-quality vehicles.

But all this history should not drive your investment decision now. Instead, consider using the price-to-earnings-to-growth (PEG) ratio that compares a stock’s market valuation to its forecasted earnings growth. By that measure, if a stock trades at a PEG of 1.0 or lower, it is reasonably priced. Higher than that, and it looks overvalued.

Here are the results of this analysis for GM and Toyota:

GM — 0.40 . It trades at a P/E of 11.1 on earnings forecast to grow 27.4% to $5 by 2012

. It trades at a P/E of 11.1 on earnings forecast to grow 27.4% to $5 by 2012 Toyota — 2.56. It trades at a P/E of 55.7 on earnings expected to grow 21.8% in the next five years.

At these PEG levels, buying GM stock and shunning Toyota could be a profitable move.

Peter Cohan has no financial interest in the securities mentioned.