New York (CNN Business) General Motors on Monday announced a major restructuring of its global business, saying it will shut production at five facilities in North America and slash its staff. GM will reduce its salaried workforce by 15%, including a quarter of the company's executives.

The moves are the first big steps in the century-old GM's transformation. The company is reinvesting money away from cars that once dominated America's roadways and putting it into technology it believes will power its future.

GM is laying off workers and shutting production to pave the way for the future.

GM's ( GM ) new motto is "Zero Crashes, Zero Emissions, Zero Congestion," signaling a shift to self-driving, electric vehicles. But the restructuring is also about making cars people want now. Customers are increasingly shunning sedans in favor of SUVs and hatchbacks.

The company said the plan would make it more efficient, saving $6 billion a year by the end of 2020. GM said its slimmed down production plan would allow it to share technology across all of its vehicles and reduce the amount of time and workers it takes to build cars.

"The actions we are taking today continue our transformation to be highly agile, resilient and profitable, while giving us the flexibility to invest in the future," CEO Mary Barra said in a statement.

GM said it would shut operations at plants in Detroit; Oshawa, Ontario; Warren, Ohio; White Marsh, Maryland; and Warren, Michigan. The plants made sedans that have waned in popularity, including the Chevrolet Volt, Impala and Cruze, the Buick LaCrosse, and the Cadillac CT6 and XTS. GM said it will no longer make those cars.

Two of the plants made engines and parts for those cars. The facilities made some trucks, but those trucks are also made in Mexico.

The company also said it would close three plants outside North America by the end of next year. One of those closures, in South Korea, had been previously announced.

The transition will come at the expense of about 8,000 salaried workers, and 6,000 hourly workers will either lose their jobs or be reassigned to other plants. The company last month offered voluntary buyouts for 18,000 salaried workers.

General Motors of the future

The company, which was incorporated in 1908, came back from the brink after its 2009 bankruptcy and federal bailout, returning to profitability in 2010. Today it is performing reasonably well — earnings are up and the balance sheet is healthy. But sales are starting to slip in China and North America, two of GM's biggest and most important markets.

Barra said in a conference call with reporters that she wanted to transition the company when times were good. That brought praise from Wall Street: GM's stock rose more than 5% Monday.

"In contrast to times past, General Motors, under CEO Mary Barra, is trying to get ahead of a potential crisis by making cuts now," said Michelle Krebs, executive analyst at Autotrader.

It is battling rival automakers to be first in line to mass-produce the cars of the future. Ford ( F announced in April it would just about end all production of sedans in North America.

But the next automaking leader may not be GM or one of its traditional rivals. Alphabet ( GOOGL ), Apple ( AAPL ), Uber and Tesla ( TSLA ) are leading Silicon Valley's push into the self-driving cars. That's why GM bought Cruise, a separate company with big backing from SoftBank and Honda. GM expects to spend $1 billion on Cruise this year to build the next generation of cars.

In the meantime, GM is trying to reinvent how it makes vehicles. It will share more components across cars and make better use of computer models and virtual tools. It will integrate its vehicle and engine engineering teams, and it will bring more employees together, trimming the number of campuses for car developers.

The human cost

The soon-to-be shuttered North American plants are the first to close since 2010.

"While this may be a market necessity, I am concerned about the brain drain: a loss of valuable legacy knowledge and experience as long-term GM employees are let go," said Rebecca Lindland, executive analyst at Kelley Blue Book.

The Oshawa plant, located just outside of Toronto, was built in 1953. But Chevrolet has been making cars in Oshawa for more than a century. Over the years, Oshawa has been responsible for producing cars from GM's most important brands, including Chevrolet, Buick and Pontiac, and it is equipped to make just about every model GM sells.

Canadian Prime Minister Justin Trudeau said he was "deeply disappointed" by the decision to shut the Oshawa, Ontario plant. "GM workers have been part of the heart and soul of Oshawa for generations - and we'll do everything we can to help the families affected by this news get back on their feet."

GM workers have been part of the heart and soul of Oshawa for generations - and we'll do everything we can to help the families affected by this news get back on their feet. Yesterday, I spoke with @GM's Mary Barra to express my deep disappointment in the closure. — Justin Trudeau (@JustinTrudeau) November 26, 2018

GM's unions aren't happy. The union that represents its Canadian workers said in a statement that GM's expected decision does not "live up to the spirit" of certain commitments the company made to union members during 2016 contract negotiations. Some workers at the Oshawa plant walked off the job Monday.

The four American plants employ a combined 3,800 hourly and salaried staff, and the Oshawa facility employs 2,900. The Detroit-Hamtramck facility is GM's last in the city, and the Lordstown plant in Ohio was one of its biggest.

The United Autoworkers union said it would fight the decision.

"This callous decision by GM to reduce or cease operations in American plants, while opening or increasing production in Mexico and China plants for sales to American consumers, is, in its implementation, profoundly damaging to our American workforce," said Terry Dittes, UAW vice president.