General Motors Co. was raised to investment grade for the first time in eight years and moved to continue paying back stakeholders from its 2009 bailout with plans to buy preferred shares held by a union health-care trust.

Moody’s Investors Service raised the credit ratings of Ford Motor Co. and General Motors Co. to the cusp of investment grade, citing new U.S. labor contracts that preserve the automakers’ cost positions.

Ford Motor Co. Chief Executive Officer Alan Mulally said he plans to stay with the automaker as it works to regain its investment-grade credit rating and restore the common stock dividend it suspended five years ago.