SAO PAULO/DETROIT (Reuters) - General Motors Co said on Tuesday it would invest $2.7 billion in two Brazilian factories over the next five years, sparing them from a shakeup of the automaker’s operations, a decision hailed by the governor of Brazil’s largest state.

Slideshow ( 2 images )

Sao Paolo state Governor Joao Doria told a joint news conference with GM executives that the plants in Sao Caetano do Sul and Sao Jose dos Campos had been slated for closure last December, and said he convinced GM to reverse the decision, saving jobs.

Last November, GM said it would slash thousands of jobs around the world and would close two unspecified plants outside of North America by the end of 2019.

The company declined to say whether its restructuring plans had referred to the two Brazilian factories, and declined to comment on whether the two plants had been slated for closure as Doria claimed.

Sitting next to Doria at the news conference, GM’s CEO for South America, Carlos Zarlenga, also did not directly address Doria’s recounting of the negotiations with GM.

Doria, a former businessman and reality TV show host, took office in January and became a vocal advocate for the state’s auto industry. Earlier this year, he said he would find a buyer for a Ford Motor Co plant that is slated to close, after the U.S. automaker said it had tried and failed to find one.

At Tuesday’s news conference, Doria said GM told him in a call days before his inauguration that it planned to close the plants.

“I thought it was going to be good news,” Doria said. “But to my surprise I was told that the next day GM CEO Mary Barra would announce the closing of two factories in Sao Paulo. I fell off my chair.”

He said he dispatched his future state finance minister to fix the situation and landed a meeting in Miami with GM executives. He said 65,000 workers employed directly and indirectly by GM would have lost their jobs without his intervention.

Earlier this month, Doria announced an incentive plan granting automakers a 25 percent reduction in value added taxes if they created at least 400 jobs and invested at least 1 billion reais. At the news conference, GM announced it was creating 400 new jobs.

Zarlenga said the future of its Sao Paulo factories had presented GM “a really serious problem,” but did not confirm that the automaker had considered closing them down.

GM, the sales leader in Brazil, South America’s largest market, had warned local employees it was dealing with heavy losses and “sacrifices” would be necessary.

As announced, the plan pales in comparison to GM’s most recent investment plan in Brazil in 2014, which totaled $4 billion. However, the announcement does not include potential future investments in the automaker’s plants elsewhere in the country.