Ford Motor Co. plans to produce a future electric car in Mexico rather than make it in the U.S., reversing plans announced in January to make its Flat Rock, Mich., assembly plant near Detroit its main electric-vehicle production site.

Instead, Ford will convert that suburban Detroit factory into a manufacturing hub for future driverless vehicles, a top company official said. And it plans to create a dedicated assembly line for electric vehicles at its plant in Cuautitlan, Mexico, with production slated to begin in 2020.

The auto maker in January had said it would spend $700 million on its Flat Rock, Mich., assembly plant near Detroit, to serve as its main electric-vehicle production site.

Moving electric-vehicle production to Mexico will likely improve the business case for battery-electric vehicles by producing them in a lower-cost country. Electric vehicles remain a niche vehicle and most auto companies lose significant amounts of money on each one they build.

The move could be risky, however, as President Donald Trump has in the past criticized auto makers for making vehicles in Mexico and shipping them to the U.S. Ford earlier this year canceled plans for a new factory in Mexico amid pressure from Mr. Trump.