* Earnings of $1.88 per share beat Wall Street view of $1.18
* No longer importing foreign light, sweet crude
* 2013 Capex seen at $2.5 billion
* Shares hit highest level in more than four years (Adds analyst comment, financial and industry details, updates share price)
By Anna Driver
Jan 29 (Reuters) - Valero Energy Corp posted a surprisingly strong quarterly profit on Tuesday, as the largest independent U.S. refiner drastically cut its dependence on foreign crude in favor of cheaper domestic supplies.
The results, which sent shares up more than 11 percent, are the latest sign of how the boom in U.S. shale oil production is redefining the entire oil sector, from the wellhead to the gas pump.
In November, the International Energy Agency forecast that U.S. oil output, aided by surging volumes from shale and other onshore rock formations, could top production from Saudi Arabia and Russia by 2017.
To take advantage of the boom, refining companies are investing heavily in railcars, barges and other means to bring less expensive oil from Texas and North Dakota to their refineries in many parts of the country.
Thanks to a bulked-up logistics system, Valero in the fourth quarter replaced all imported light foreign crude with cheaper domestic crude at its Gulf Coast and Memphis refineries, Chief Executive Officer Bill Klesse said in a statement.
"Certainly (Valero) took advantage by backing out all their foreign sweet barrels and running more attractively priced domestic barrels," said Ann Kohler, analyst at Imperial Capital LLC in New York. "We've had a real renaissance of domestic crude production."
With Valero expecting more lower-priced U.S. and Canadian crudes to become available, the company said it is considering ways to increase the amount of those fuels it processes.
A budgeting priority this year will be spending on railcars, rail unloading facilities, pipelines and terminals, all investments made to increase the company's access to shale oil and less-expensive Canadian crudes, Valero said on a conference call with analysts.
Fourth-quarter profit rose to $1.0 billion, or $1.82 per share, from $45 million, or 8 cents per share, a year earlier. Revenue was flat at $34.7 billion.
Excluding a noncash asset impairment charge, Valero posted a profit of $1.88 per share. On that basis, Wall Street analysts, on average, expected $1.18.
The company forecast capital spending this year at about $2.5 billion, down from $3.4 billion last year.
Valero also said it plans to spin off its retail business to shareholders in the second quarter, once it receives clearance from the Securities and Exchange Commission and a favorable tax ruling from the Internal Revenue Service.
Refiners Marathon Petroleum Corp and Phillips 66 are reporting fourth-quarter earnings on Wednesday.
Valero shares were up 11.5 percent in midafternoon at $43.29, the highest level in more than four-and-a-half years.
Reporting by Anna Driver in Houston; additional reporting by Krishna N. Das in Bangalore; editing by Saumyadeb Chakrabarty, John Wallace, Lisa Von Ahn, Jeffrey Benkoe and Matthew Lewis