As these things often happen, it was rumored in the Japanese press and then confirmed hours later.

Panasonic, the huge Japanese consumer electronics conglomerate, is investing in Tesla Motors, building on a previous agreement to work together on large-format lithium-ion cells for electric car battery packs.

For years, Panasonic has had a joint venture with Toyota to manufacture the nickel-metal-hydride battery packs used in Toyota's growing line of hybrid-electric vehicles, including the quintessential Prius.

Toyota recently took a stake in Tesla and sold the company its Fremont, California, assembly plant, so the tieup neatly triangulates the startup, the huge global automaker, and its battery company.

The total investment was $30 million, at a price of $21.15 a share. Tesla shares [NASDAQ:TSLA] soared from an offering price of $17 to close as high as $23.89, valuing the company at $2.2 billion. Tesla shares closed yesterday at $21.77.

According to the press release, "Panasonic and Tesla intend to explore joint marketing and sales of battery packs that would be designed and assembled by Tesla using Panasonic's battery cells."

Last year, before the Toyota deal, German automaker Daimler had invested $50 million for 9 percent of Tesla before its successful IPO this spring.

Tesla already sells battery packs to Daimler, which uses them in both its Smart Electric Drive minicar and its Mercedes-Benz A-Class E-Cell subcompact. Low-volume test fleets of both vehicles have been built to let the company accumulate real-world data on electric-car use.

With the new investment by Panasonic, some analysts feel it may only be a matter of time before Daimler sells its stake in Tesla Motors--if it's lucky, at a profit. Analysts also feel Tesla is unlikely to survive as an independent carmaker but will likely be sold.

Tesla has thus far sold roughly 1,400 of its $109,000 Roadster sports car, and says it will launch its Model S all-electric luxury sports sedan during 2012. It also plans a Model X electric crossover during 2014.

[Tesla Motors, Reuters]