The New York area is home to the Yankees and the Knicks, the Belmont Stakes and the Westminster Kennel Club Dog Show. But the city that is the capital for so many sports has hardly been a center for auto racing.

In July, that will change, when the Formula E circuit comes to the city for two races.

The twist is that while the cars look like the open-wheel speedsters you would see in Indianapolis or Monaco, they run 100 percent on electricity, making Formula E something of a green racing series.

Of course, the races will be held in Brooklyn.

“The world has been trying for years to race in New York City, and it has never been possible,” said Alejandro Agag, the chief executive of Formula E. “Everyone has been trying to race in New York City. Formula One, everyone. New York is the capital of the world. We are really over the moon.”

The city and Formula E announced the races at a news conference on Wednesday afternoon. The races will be held on a Saturday and Sunday to be determined in late July as part of the circuit’s third season. The course will be laid out at the Brooklyn Cruise Terminal in Red Hook.