GM announced Barra, 51, the executive vice president of global product development, purchasing and supply chain, would become its first female CEO.
Akerson, 65, pushed his planned retirement ahead by several months, following his wife's recent diagnosis of advanced stage of cancer, the company said.
GM said Akerson guided the company to "record profits and dramatic improvement in vehicle quality." He also steered the company through its return to independence. GM Monday announced the government had sold all of its GM stock, four years after accepting $50 billion in bailout funds that helped the company emerge from a mid-recession bankruptcy.
"I will leave with great satisfaction in what we have accomplished, great optimism over what is ahead and great pride that we are restoring General Motors as America's standard bearer in the global auto industry," Akerson said in a message to employees.
Barra, who is an engineer, who has worked in manufacturing, engineering and administration. She has been with GM for 33 years.
"With an amazing portfolio of cars and trucks and the strongest financial performance in our recent history, this is an exciting time at today's GM," Barra said in a statement.
"I'm honored to lead the best team in the business and to keep our momentum at full speed," she said.
The company's board selected former Chairman and CEO of Cummins Inc. Theodore Solso, 66, to succeed Akerson as chairman of the company.
Solso has been on the GM board since June 2012.