About 5,000 barrels of oil, or about 210,000 gallons, gushed out of the Keystone Pipeline on Thursday in South Dakota, blackening a grassy field in the remote northeast part of the state and sending cleanup crews and emergency workers scrambling to the site.

“This is not a little spill from any perspective,” said Kim McIntosh, an environmental scientist with the South Dakota Department of Environment and Natural Resources. No livestock or drinking water sources appeared to be threatened, Ms. McIntosh said, and no farm buildings or houses are within a mile.

The spill, near Amherst, S.D., comes just days before regulators in neighboring Nebraska decide whether to grant the final permit needed to begin construction on a different pipeline proposal, the Keystone XL, which would be operated by the same company. An announcement in Nebraska is expected on Monday.

The pipeline company, TransCanada, said in a statement that the South Dakota leak was detected around 6 a.m. local time on Thursday. The pipeline was shut down, and the cause of the leak was under investigation.