A Tesoro Corp. pipeline in North Dakota that carries oil from the Bakken shale formation to rail operations leaked about 20,000 barrels of crude near Tioga, in the northern part of the state.

Tesoro shut the segment involved and repairs were underway, the company said Thursday. Most of the region's oil production, or about 67 percent using July numbers, is exported by rail, with 25 percent sent by pipe and 7 percent used at Tesoro's Mandan, N.D., refinery, according to the state Pipeline Authority.

Bakken crude priced in Clearbrook, Minn., weakened to a $14 discount against West Texas Intermediate on Monday, compared with $10 below the domestic benchmark on Sept. 27, according to data compiled by Bloomberg. The differential narrowed to $12 a barrel on Thursday in New York.

The state was notified of the spill on Sept. 30, and the initial estimate of the amount released was 750 barrels, said Dave Glatt, chief of environmental health for North Dakota. He said the extent of the 7.3-acre spill was discovered later because much of the oil was below the surface, permeating the soil to a layer of clay 10 to 12 feet underground.

The spill is the second-largest in state history, Glatt said. The date of the initial release wasn't known.

"It's probably something that's been going on for a little bit of time, we just don't know how long," Glatt said. "Due to the extent of what happened, what kind of leak was it and what kind of safeguards in place do they have to detect these things, that will be part of the investigation."

The line feeds two train-loading sites, one near Columbus and one near Tioga, said Darren Jennings, a Louisville, Ky.-based analyst with energy data provider Genscape Inc. Loading volume at Tioga decreased by 21 percent in the first nine days of October compared with the same period the previous month, he said.

Jennings said the Tioga terminal belongs to Hess Corp. A request for comment from Hess wasn't immediately answered.

The Columbus site is operated by Global Partners LP and Basin Transload LLC, Jennings said. No decrease in loadings was seen there, he said, adding that both sites can receive crude by truck as well as pipeline.

A representative of the U.S. Pipeline and Hazardous Materials Safety Administration was at the spill site, Glatt said. A call to the agency wasn't immediately returned.