Despite strong opposition from auto dealers, Maryland Gov. Larry Hogan signed a bill Tuesday that gives Tesla Motors Inc. the right to sell its luxury electric cars directly to consumers in the state, starting in October. Tesla has been challenging dealers in many states who say manufacturers should stick to the traditional franchise dealership model.

Currently, 25 states prohibit Tesla from selling its cars through its own boutique stores.

The Maryland law, specifically crafted for Tesla, allows “a manufacturer or distributor to be licensed as a vehicle dealer if the manufacturer or distributor deals only in electric or nonfossil-fuel burning vehicles.” It was approved by the state’s Legislature last month. In March, New Jersey Gov. Chris Christie, like Hogan a Republican, signed a similar bill into law.

Tesla's stock jumped more than 2 percent to $244.49 in morning trading Tuesday.

Dealers say preventing manufacturers from controlling direct sales is good for consumers, because dealers make money from maintenance and repairs and are more likely to identify problems, such as safety defects, than manufacturer-controlled outlets.

But Tesla argues that the unique nature of its cars and the way the company interacts with customers makes it different from a GM or a Toyota. The company has held firm against using franchised dealers because, much like Apple Inc., Tesla wants control over its retail channels.

The company uses small boutiques, often nestled in malls, rather than conventional dealerships. In states where it cannot sell directly to consumers, including Texas, Louisiana, Michigan and Maine, Tesla operates what it calls “galleries” instead of “stores.” Customers can browse catalogues and kick the tires of a Model S in a Tesla gallery, but they cannot perform test drives or pick up their new cars from them. Customers in those states must order their cars online and have them delivered directly.