General Motors plans to invest $2.7 billion in two of its plants in Brazil over the next five years.

GM will invest the money in plants in Sao Caetano du Sul and Sao Jose dos Campos for improvements, Reuters reported. The move spares the factories from disruption in operations, a move the governor of Brazil's largest state hailed.

Sao Paolo state Governor Joao Doria said that the two plants were set for closure last December and he convinced GM to reverse the decision and save the jobs there.

But five plants in North America still face closure. Last November, GM said it would idle its assembly plants Detroit Hamtramck, Lordstown in Ohio and Oshawa in Ontario this year. It will also close Warren Transmission and a transmission plant in Maryland. Detroit Hamtramck is still building the Cadillac CT6 sedan until January 2020.

GM has faced harsh criticism for its restructuring plan by politicians and unions. Over the weekend, President Donald Trump unleashed a series of tweets critical of GM's move and urging the automaker to reopen its plant in Lordstown.

More:Donald Trump attacks GM, UAW over plans to close Lordstown plant

More:Trump can't bully GM to reopen plants, industry experts say

Reuters said GM declined to comment on whether its restructuring plans referred to the factories in Brazil or if those plants had been slated for closure as Doria said. Doria took office in January after having been a businessman and a former reality TV show host, Reuters said. He's become a vocal advocate for the auto industry and earlier this year said he'd find a buyer for a Ford Motor Co. plant that is set to close after Ford said it had failed to find a buyer.

Earlier this month, Doria unveiled an incentive plan giving carmakers a 25 percent reduction in value added taxes if they created at least 400 jobs and invested at least 1 million reals, Reuters said. GM announced Tuesday it was creating 400 new jobs in Brazil.

In January, GM had warned local employees they might lose their jobs as it was facing heavy losses in the market. The warning surprised workers at the time because GM has surpassed Volkswagen and Fiat Chrysler Automobiles in sales as Brazil's economy recovered. GM sold 690,000 vehicles in South America last year, up from 669,000 in 2017.

Still GM CEO Mary Barra told investors in January that GM was working on a plan to restructure its operations in South America to address financial challenges there.

More:GM's global gamble to fund a big bet on the future

More:Ford, GM face another restructuring, but this time they are profitable

Contact Jamie L. LaReau at 313-222-2149 or jlareau@freepress.com. Follow her on Twitter @jlareauan. Read more on General Motors and sign up for our autos newsletter.