(Reuters) - Tesla Inc has agreed to buy energy storage company Maxwell Technologies Inc for $218 million in an all-stock deal that could help the electric car maker produce batteries that hold more energy and last longer at a time when it needs to cut costs and faces growing competition.

A Tesla car is seen in Santa Monica, California, United States, October 23, 2018. REUTERS/Lucy Nicholson

Tesla is rapidly increasing production of its Model 3 sedan and needs to lower the price to reach a broader customer base than its pure luxury vehicles.

Maxwell executives told investors in January that it had developed and patented a “dry electrode” technology that could significantly increase the driving range and reduce the cost of electric vehicle batteries. In a presentation, Maxwell said it expected strategic alliances “within six months” centered around this technology.

The company also makes ultracapacitors, which discharge energy faster than batteries and are seen as complementing battery technology.

Ultracapacitors, combined with the energy of batteries, can enable rapid response times, function across a broader temperature range and lengthen battery life by up to two times, according to a blog post on Maxwell’s website.

Volvo-owner Geely Holding Group last May announced a deal with Maxwell and described the company’s ultracapacitor technology as helping to deliver “peak power” for hybrid cars.

“Tesla needs Maxwell’s solvent-free battery electrode manufacturing for a viable path to lower battery costs,” said Craig Irwin of Roth Capital Partners. “Real competitors are coming now, so Tesla needs to move fast.”

Maxwell’s customers also include General Motors and Lamborghini.

The offer values each Maxwell share at $4.75, representing a 55 percent premium to the stock’s closing price on Friday, the companies said. Maxwell shares rose to trade at $4.58.

Currently, Japan’s Panasonic Corp is the exclusive battery cell supplier for Tesla cars.

Tesla chief Elon Musk had highlighted the importance of ultracapacitors back in 2013.

"I'm a big fan of ultracapacitors. Was going to do my PhD at Stanford on them. But we need a breakthrough in energy density...," Musk had tweeted here.

Tesla also sells power storage, often in conjunction with its solar power business, and ultracapacitors could be used in backup systems for homes and for utility power grids.

Maxwell expects the deal, which has already been approved by its board, to close in the second quarter of 2019, or shortly thereafter.

DLA Piper was Maxwell’s outside legal counsel, while Barclays Capital was the independent adviser. Wilson Sonsini Goodrich & Rosati represented Tesla as outside legal counsel.