Ford said Tuesday it is investing $1.2 billion in three Michigan facilities.

President Trump, a frequent critic of Ford during the campaign, praised the announcement Tuesday, and called it an example of car companies "coming back to U.S."

Here's what's behind Ford's announcement.

Most of this investment was agreed upon as part of a 2015 labor deal with the United Auto Workers union.

For example, Ford is investing $850 million in its Michigan Assembly Plant in Wayne, where 3,700 people work. Ford originally pledged to put $700 million into that plant as part of the labor deal. In January, it announced plans to build its new Bronco SUV and Ranger pickup there.

Ford isn't bringing any work back to the United States from Mexico, or any other foreign country. It is however, securing that those 3,700 jobs in Wayne won't go to Mexico any time soon.

Related: Trump and jobs - a running fact check

The Wayne plant currently makes the small Focus and C-Max cars, but that production will shift to Mexico.

Joe Hinrichs, the head of Ford's North and South America unit, told CNNMoney the company was confident in the additional investment, even though U.S. auto sales seem to be topping out.

"We believe it's always a good time to invest in your portfolio, adding new products like the Bronco and Ranger, that are exciting to customers," he said. "We're proud of fact that we make more vehicles in U.S. than anyone else."

The vehicles it will now build in Wayne are more profitable than the small cars being shifted to Mexico.

An engine plant in Romeo, Michigan, where 500 people work, will get a $150 million investment, a move that will create or retain 130 jobs. That was also spelled out in the labor deal.

Ford is also investing $200 million in a data center in Michigan.

The investments come on top of a January announcement by Ford (F) that it would sink $700 million into electric and self-driving cars at its plant in Flat Rock, Michigan, creating 700 jobs. It also dropped plans for a $1.3 billion small car assembly plant in Mexico -- but it's shifting those cars to another plant in Mexico, not bringing them back to the United States.

Still, Trump, who before the election inaccurately accused Ford of planning to move all its U.S. plants to Mexico, has had only praise for Ford since the January announcement.

He has also praised other automakers who have announced U.S. investments and hiring plans -- often following their own 2015 labor deals.

Related: Ford says profit will fall 50%

On Jan. 8, Fiat Chrysler (FCAU) announced a $1 billion investment to expand factories in Ohio and Michigan, which will create 2,000 jobs by 2020.

And General Motors (GM), which is planning to layoff 4,400 workers at four plants, has balanced that with plans to invest $1 billion in U.S. factories and create or retain 7,000 domestic jobs. It also said about 700 of the workers being laid off will be rehired in the future.

Trump cited those auto hiring plans on a March 15 trip to Michigan.

"And that's just the beginning, folks. In fact, I told them, that's peanuts -- that's peanuts," he said in March. "We're going to have a lot more."