The Tesla Model S. Tesla The Tesla Model X and Model S are getting longer ranges and an improved Ludicrous mode thanks to a new battery option, Tesla announced on Tuesday.

CEO Elon Musk said Tesla will offer a new 100-kilowatt-hour battery option for the Model S and Model X cars that have new "Ludicrous" modes. The new battery option will extend the range of the Model S to 315 miles per charge, making it the first electric car on the market to exceed 300 miles of range.

The Model X will also be offered with a 100 kilowatt-hour battery option to extend its range to 289 miles.

The Model S P90D previously had the longest range at 270 miles. The P90D version of the Model X provided 250 miles of range.

The upgrade will also enable the Model S P100D Ludicrous to accelerate from zero to 60 mph in just 2.5 seconds, making it the world's third-fastest production car. That places it behind the the LaFerrari and the Porsche 918 Spyder.

The larger battery pack will also make the Model X the world's quickest SUV with the ability to accelerate to 60 mph in 2.9 seconds.

Tesla drivers who own a Model S or Model X P90D Ludicrous can upgrade to the 100 kilowatt-hour packs for $20,000. Those who ordered a P90D Ludicrous but haven't received it yet can upgrade for $10,000.

The reason why it's more expensive for those who already have a Model S or Model X P90D Ludicrous is because the battery has to be recycled.

For those looking to buy now, the Model S P100D with Ludicrous mode starts at $134,500. The Model X P100D with Ludicrous mode starts at $135,500.

Competition is mounting in the electric-car space, as more automakers are racing to release vehicles with longer ranges. Volkswagen is expected to reveal an all-electric car in October that could have as much as 372 miles of range, and Porsche is working on a Tesla killer with 300 miles of range that could pop up in showrooms in 2019.

The new battery option doesn't come as a surprise. Dutch blog Kenteken.tv reported earlier in August that RDW, the Dutch authority responsible for vehicle registrations, has approved a 100-kilowatt-hour battery option for both Tesla cars.

Additionally, a hacker found a mention of a P100D in the software that runs the cars, hinting that a Tesla with a more powerful 100-kilowatt-hour battery could be on the way in March.