It’s shaping up to be one of the best years ever for the ethanol business.

Operating profits for many ethanol makers more than doubled in the second quarter compared with last year, reflecting lower prices for corn and strong demand for the fuel, sustained partly by exports.

Valero Energy, which owns 11 U.S. ethanol plants, including one in Minnesota, reported operating income of 63 cents per gallon, more than double that of the quarter a year ago.

“It’s nice to have that,” said Brian Kletscher, CEO of Highwater Ethanol, a farmer-owned producer in Lamberton, Minn., whose operating profit more than doubled and net earnings rose 64 percent for three months ending in July. “The ethanol industry needed margins like this to stabilize.”

Just two years ago, the nation’s 212 ethanol plants, including 21 in Minnesota, saw profits take a free fall as the price of corn climbed in some regions to $8 per bushel. More than 20 U.S. ethanol plants were shuttered, though many have reopened, including a plant in Buffalo Lake, Minn., earlier this month.

Corn is the main ingredient in making ethanol. In Minnesota, corn sold for $3.55 per bushel in August, less than half the price during the peak of the drought two years ago, government data show. With a record corn crop projected this year, ethanol industry officials are upbeat, although ethanol’s recent, lower selling price could cut into profit margins.

Green Plains Renewable Energy, the nation’s fourth largest ethanol maker whose 12 plants include ones in Fergus Falls and Fairmont, Minn., is projecting a record year. The Andersons, a producer with plants in Ohio, Indiana, Michigan and Iowa, reported record ethanol profits in the quarter.

“These are margins that no one has seen in the ethanol business,” Chief Operating Officer Harold Reed told stock analysts in August.

Another big producer that reported stellar second-quarter ethanol results is Archer Daniels Midland, whose ethanol operations include a plant in Marshall, Minn. Valero, owner of Minnesota’s largest ethanol plant in Welcome, Minn., reported that overall ethanol operating profits nearly doubled to $223 million over the same quarter last year.

Smaller producers also did well, including Bloomington-based Advanced BioEnergy, which produces ethanol in two South Dakota plants, and the jointly managed Granite Falls Energy and Heron Lake BioEnergy plants located in those Minnesota cities. Gevo, owner of a plant in Luverne, Minn., resumed making money on ethanol, helping to cut its losses as it tries to ramp up production of an alternate biofuel.

Some Minnesota ethanol plants have farmer-investors who own membership units. Granite Falls Energy reported second-quarter earnings per unit of $425, up nearly sixfold from the same quarter last year. Highwater Ethanol’s earnings per unit rose to $866, up 174 percent over the quarter last year.

Not all earnings get distributed to members, but the payments to farmers can be a boon in times of low corn prices.

“If you are a farmer invested in an ethanol plant, the potential is high that it will cushion a downfall in the farm economy,” said Highwater’s Kletscher, who also is president of the Minnesota Biofuels Association. “If you think back, this is why farmers developed ethanol plants.”

Alex Breitinger, a commodities broker with Paragon Investments of Valparaiso, Ind., said ethanol producer margins probably will narrow because of a slight drop in ethanol futures and an increase in corn futures. One thing to watch, he said, is whether farmers plant less corn in 2015, affecting prices going forward.

Transportation also poses a lingering problem. To reach markets, ethanol relies heavily on railroads, which are congested by oil trains, grain and coal shipments and other traffic. Kletscher said some plants, including Highwater’s, have shut down production for a day or more because transport was unavailable and on-site storage tanks were full.

Yet the ethanol business has remained strong partly because the fuel is finding international buyers. Exports of ethanol were up 54 percent to 10 million gallons in the first half of this year compared with the period in 2013, and are on track to match the high-export years of 2011 and 2012, government data show.

Exports help with what the industry calls the “blend wall.” U.S. motor fuel is typically blended at 10 percent ethanol. U.S. producers already have the capacity to produce more than that. But higher-percentage blends like E-15, or 15 percent ethanol, have been slow to make inroads into the market. E-15 sales have risen in Minnesota, which now has 25 stations selling the blend.

Breitinger said the United States is energy rich thanks to the boom in oil and gas extraction from shale. Although gasoline is exported, crude oil exports are barred by U.S. law.

“But ethanol can be exported, so they really have hit a sweet spot,” he said.