General Motors Co sold its preferred shares in auto lender Ally Financial Inc for $1 billion in what the automaker on Tuesday called a step to strengthen its balance sheet.

The transaction is expected to close in the next few days, GM spokesman James Cain said, resulting in a $300 million book gain to be recorded in the first quarter.

Today, we are taking another step forward in our strategy to strengthen and simplify the company's balance sheet, GM Chief Financial Officer Chris Liddell said in a statement.

Ally, which is majority-owned by the U.S. government, is readying an initial public offering for this year. The offering will help the government sell some of its shares in Ally and begin to exit its investment in the company.

A Treasury spokesman declined to comment on the GM deal.

The sale came the day Ally, which is majority-owned by the U.S. government, filed a prospectus with U.S. regulators flagging GM's plans to sell its preferred shares for $1.02 billion.

In 2006, GM sold a 51 percent stake in Ally, then known as GMAC, to a group of investors led by Cerberus Capital Management in 2006. GM now has a 9.9 percent interest in Ally's common stock both directly and through a trust.

The underwriters on the deal were Credit Suisse , Bank of America-Merrill Lynch , Deutsche Bank Securities and Barclays Capital .

(Reporting by Deepa Seetharaman; Editing by Bernard Orr and Carol Bishopric)