By Deena Beasley

LOS ANGELES (Reuters) - California voters turned down a ballot initiative aimed at reining in rising prices for prescription drugs after pharmaceutical companies spent more than $100 million to fight it.

The California Drug Price Relief Act, also known as Proposition 61, sought to limit state health programs from paying more for medications than the U.S. Department of Veterans Affairs (VA), which receives the steepest discounts in the country.

As of Wednesday morning, with more than 99 percent of precincts partially reporting from Tuesday's election, the vote was 46 percent in favor of the measure and 54 percent opposed, according to California's Secretary of State.

"The pharmaceutical companies spent a lot to defeat this," said Stuart Schweitzer, professor of health policy and management at the University of California, Los Angeles Fielding School of Public Health. "They wanted to draw a line in the sand."

The measure's defeat "reaffirms the power of the biopharma lobby," Jefferies analyst Brian Abrahams said in a note to investors on Wednesday.

The rising cost of prescription drugs came under attack during the U.S. presidential campaign. Both President-elect Donald Trump and Democratic candidate Hillary Clinton called for cost-trimming measures including allowing Medicare, the federal health plan for seniors, to negotiate prices with drugmakers.

Shares in pharmaceutical and biotechnology shares, under pressure in recent weeks, soared on Wednesday as market fears of a win by Clinton and Democrats gaining power in Congress receded. The Nasdaq Biotechnology index .NBI advanced 7 percent and was on track for its biggest single-day gain in about five years.

Proposition 61's opponents, led by global drugmakers such as Pfizer Inc and Amgen Inc, spent around $106 million. They argued that it would benefit only 12 percent of Californians, while putting the other 88 percent, and veterans across the country, at risk of higher drug costs.

Supporters, led by the AIDS Healthcare Foundation and AARP, which advocates for seniors, said only drug companies themselves can raise prices for veterans or other consumers. Vermont Independent Senator Bernie Sanders also campaigned in support of Proposition 61, calling on voters to "stand up to the greed of the pharmaceutical industry."

Proponents, who raised $17 million to support the initiative, estimated it could save California taxpayers up to $5.7 billion over 10 years, although a state legislative analysis said the financial impact is not clear.

UCLA's Schweitzer said the measure would have had only a modest impact on state drug costs.

There were also questions about how Proposition 61 would be implemented. The VA's mandated prices are listed publicly, but its steepest negotiated price discounts are required by law to be confidential.

The VA spends some $6.1 billion a year on medicines for 6 million veterans. Proposition 61 would have extended those discounts to around 4.5 million Californians, including certain members of the state's low-income Medicaid plan, state employees and retirees, university teachers and prisoners.

A similar proposition has been approved for Ohio's 2017 November ballot.

(Reporting By Deena Beasley; Editing by Mary Milliken and Grant McCool)