Auto lender Ally Financial Inc said it will sell shares worth $1 billion to boost capital levels after failing the Federal Reserve's stress test earlier this year.

The company has entered agreements with some investors for a private placement of 166,667 shares of the company's common stock, Ally Financial said in a statement.

It agreed to pay $5.2 billion to repurchase all outstanding shares of the mandatorily convertible preferred securities held by the U.S. Treasury. It will also pay $725 million to terminate the Treasury's share adjustment right.

Ally was singled out as the weakest of 18 major banks in the Fed's stress test in March and has to resubmit its new capital plan by the end of September.