(Fortune Magazine) -- For Martin Eberhard, there were many obstacles on the path to building the ultimate electric sports car. There was the scientific challenge of creating a lithium ion battery pack stable enough to power a 2,650-pound vehicle. There was the belief that Americans would stick with their gas-guzzlers, no matter what the price of oil. And there was, of course, the considerable resistance in the venture capital community to funding heavy industry.

But for Eberhard, the ultimate indignity came in early June of this year. Just days before he was finally supposed to take possession of his Tesla Roadster, a gray beauty with orange racing stripes that he had devoted the past five years of his life to building, a technician who had been driving it on the 101 freeway relayed some bad news.

The most advanced car on the planet had rear-ended a truck.

Instead of sweeping triumphantly into Eberhard's driveway, the Roadster was towed back to Tesla headquarters south of San Francisco where, under the exacting eye of the company's chairman and financial backer, Elon Musk, it would be rehabilitated.

Even with its carbon-fiber front end shattered, the car was something to behold. Eberhard had named the car for Nikola Tesla, an eccentric late-19th- and early-20th-century inventor whose name has become a byword for genius tethered to otherworldly ambition. (His legacy ranges from the AC power systems we still use today to plans for a "death ray" that would help armies fight wars with electricity.)

The Tesla itself - 400 volts of electric potential wrapped in a carbon-fiber body - is as far-out as its namesake, styled like the cars you used to see only in cartoons but charged by a high-powered outlet in your garage. Stomp the accelerator, and thick cables connecting the liquid-cooled lithium ion battery pack to a printed circuit board send all that current into a series of silicon transistors the size of your little fingernail. They are capable of switching as much as 850 amps, which drive the AC motor as high as 14,000 rpm and send the rear-wheel-drive Roadster screeching off the line, with a range of 220 miles on a single charge. Acceleration is so fast (0 to 60 in 3.9 seconds) that you get pushed back in your seat for as long as you dare to keep your foot on the aluminum pedal.

That the Tesla exists at all is a small miracle. For car geeks it has long seemed that electric vehicles are the car of the future - and always will be. First tinkered with in the 1800s, the electric vehicle (or EV) had its fate sealed with the invention by 1900 of the internal-combustion engine, which was cheaper and could travel much farther than any battery-powered model. There was another flurry of EV development during the energy crisis of the 1970s, and again in the early '90s because of a series of regulatory guidelines governing emissions. But by the late '90s, California had defanged the electric-vehicle portion of its zero-emissions mandate and soon after, GM (GM, Fortune 500), Toyota (TM), Honda (HMC), and Ford (F, Fortune 500) all shut down their EV programs. The most dramatic end would come for GM's EV1, when the Detroit automaker famously ripped the cars away from ecstatic owners and sent them to the crusher, as detailed in the film Who Killed the Electric Car?

That backdrop makes the story of the Tesla all the more remarkable. The car was conceived by Eberhard, an engineer, serial entrepreneur, and inventor (his name is on battery-cooling, electric motor, and power electronics patents filed by Tesla Motors). He was convinced that if he could outfit an existing sports car chassis with loads of laptop batteries, it would be feasible to build and he'd find plenty of buyers among the speed-loving, planet-conscious Silicon Valley set and beyond. But given that he had zero experience in the auto world and that gas was at a relatively cheap $1.50 a gallon, Eberhard, 48, couldn't find a VC firm willing to give him enough to build the car. Which is how he came to Elon Musk.

The 37-year-old Musk had co-founded PayPal, was forced out of the online-payment company, but cashed in when it was sold to eBay (EBAY, Fortune 500), giving him more than enough money to launch SpaceX, a private rocket company that aims to start shuttling people to the International Space Station by 2011. Big ideas, in other words, are Musk's specialty. After a two-hour meeting in February 2004, Musk agreed to plow $6.3 million into Tesla. He would become the company's chairman; Eberhard would be CEO.

In one sense, the duo's timing couldn't have been better. Tesla has begun delivering cars just as gas prices and fears about global warming have shot to all-time highs. All those automakers that shelved plans have since restarted them. Nissan (NSANY), Mitsubishi, Daimler, Subaru, and boutique firms like Fisker Automotive are furiously working on new models - some all-electric, others range-extended EVs - but won't get to market till 2009-13. GM's Bob Lutz even credited his company's relaunch to Tesla. "If some Silicon Valley startup can solve this equation," he told Newsweek, "no one is going to tell me anymore that it's unfeasible."