* Polls show most Argentines favor the expropriation
* Spain, in reprisal, halts imports of Argentine biodiesel (Recasts, adds context, background, byline)
BUENOS AIRES, April 26 (Reuters) - Argentina's proposal to nationalize the country's biggest oil company sailed through the Senate by a 63-3 vote on Thursday, underscoring broad domestic support for a move that has infuriated foreign investors.
The bill aimed at expropriating YPF, a unit of Spanish energy major Repsol, is expected to be approved by the lower house next week and become law.
President Cristina Fernandez, a popular second-term leader who controls both houses of Congress, unveiled plans last week to seize a 51 percent stake in YPF from Repsol.
She says the parent company has under-invested and under-produced in Argentina, a charge that Repsol dismisses.
Most Argentines support the move to renationalize YPF, privatized in the 1990s after 70 years under full state control. Many blame the privatizations and free-market reforms of that decade for provoking Argentina's 2001/02 financial meltdown.
"The privatization of YPF was one of the worst mistakes of that era," Senator Miguel Pichetto, a Fernandez ally, said just before the vote was called.
Latin America's No. 3 economy has yet to return to global credit markets a decade after its crippling 2001/02 sovereign debt default -- the biggest in history.
With memories of this debacle still fresh, many voters have hailed Fernandez's calls for "energy sovereignty."
A survey published last weekend by local polling company Poliarquia showed 62 percent of respondents agreed with the expropriation, with 23 percent against it.
"The government's bill doesn't reflect a capricious or random decision," ruling party senator Marcelo Fuentes said during the marathon debate. "It's a logical result stemming from the need to reverse free-market thinking in energy policy."
The early morning vote, in which four senators abstained, was held after a 15-hour debate.
Argentina's trade surplus, a pillar of Fernandez's economic policy, shrank last year as fuel imports more than doubled - sending the issue of flagging oil and natural gas production to the top of the president's list of priorities.
Once the takeover becomes law, attention will turn to the compensation Argentina will pay Repsol for its stake. Officials have already said it will be far lower than the $9.3 billion the company has sought.
The nationalization has investors and trade partners worried about increasingly antagonistic policies such as import curbs.
Madrid has vowed to halt multimillion-dollar imports of biodiesel from Argentina in retaliation while ratings agencies Moody's and S&P said the YPF seizure could heighten Argentina's economic isolation at a time of slowing growth.
Moody's warned that other Argentine energy companies such as Pan American Energy, majority owned by BP Plc , and Petrobras Argentina now face a higher risk of government interference in the oil and gas sector.
"The expropriation will also have negative credit implications for a number of Spanish companies with significant operations in Argentina, including telecommunications group Telefonica," Moody's said.
Despite criticism from business groups about her state-centric policies, Fernandez was re-elected in October with 54 percent of the vote. She pledged during that campaign to deepen the government model pioneered by her late husband and predecessor as president Nestor Kirchner.
Fernandez, a fiery public speaker sometimes compared to Argentina's famous first lady Evita Peron, has worn only black since Kirchner's sudden death in 2010 and she has dedicated YPF's takeover to his memory.
In a speech on Tuesday, Fernandez acknowledged she was nervous when she announced the YPF takeover plan: "They weren't nerves caused by doubts or insecurities. On the contrary; I'm absolutely certain that this is the only way.
"What upset me was that he (Kirchner) couldn't be here to see such a historic moment." (Editing by David Cowell)