The resurgence of the oil industry can be traced back to what happened in Congress one day in December 2015.

That's when lawmakers ended the 40-year ban on U.S. oil exports. Crude pumped in Texas, Oklahoma and North Dakota could suddenly be shipped overseas.

At the time, excess supply was wreaking havoc on the energy industry. Too much American oil was sitting around in storage, pumped out of the ground but with no one to buy it. Crude eventually crashed to $26 a barrel.

But that glut is disappearing, thanks in part to booming oil exports from the United States. Crude that was once trapped inside the country is now going to Europe, Latin America and even China.

The United States exported a record 1.7 million barrels of oil per day in October 2017, according to the most recent stats from the Energy Information Administration. That's four times as much as in 2015, when federal law prohibited shipping oil to most places except Canada.

"What happened is pretty dramatic," said Tom Kloza, global head of energy analysis at the Oil Price Information Service. "It basically drained the U.S."

Related: America could become oil king of the world in 2018

The U.S. oil inventory -- the crude that's been pumped out of the ground but not yet sold -- has dropped 15% over the past year, according to the EIA. Stockpiles have shrunk 10 weeks in a row, and are the smallest since February 2015.

All that excess oil in storage is finally moving to market now that American producers can export it. And as the country works through all that supply, the price is going up. Crude has spiked 9% this year and hit a three-year high of $66.66 a barrel on Thursday.

The end of the export ban is just one factor supporting the energy market. More consequential was the agreement by OPEC and Russia to rein in output. Crude prices have also benefited from the stronger economy, which creates more demand for oil, and the weaker U.S. dollar.

Related: Russia, Saudi Arabia not worried about U.S. oil boom

Now that oil fetches a higher price, domestic producers are pumping more, especially from shale hotbeds like the Permian Basin of West Texas and New Mexico

And some of that oil is finding a home overseas. After Canada, the top destinations for American crude in 2017 were China (16.5%), Britain (11.3%) and the Netherlands (8.4%), according to the energy research firm ClipperData.

Soaring domestic production has also allowed the United States to import less, including from unstable places like Venezuela and the Middle East. The United States still imports more oil than it exports, but that gap is shrinking.

"The U.S. is becoming much more self-sufficient," said Matt Smith, ClipperData's director of commodity research.

Forecasters even believe the U.S. could soon topple Russia and Saudi Arabia as the world's largest oil producer.

"Exports are going to get bigger and bigger and bigger," Kloza said. "That has real consequences."

He predicted the United States could eventually be a top four oil exporter, surpassing OPEC countries like Iran, Iraq and the United Arab Emirates.

"No one wants to cede market share to the U.S.," Kloza said.

For their part, Russia and Saudi Arabia insist they aren't nervous about the American oil machine.

"Demand is growing," Saudi energy minister Khalid al-Falih said this week from the World Economic Forum in Davos, Switzerland. "I don't think we should worry."

Related: Trump hasn't killed renewable energy

OPEC probably realizes that outdated infrastructure will limit how much oil the United States can ship overseas. Pipelines, shipping terminals and docks need upgrades badly.

"U.S. exporters must still use smaller, less-economic vessels or complex shipping arrangements, which add to costs," the EIA said in a recent report.

The other key: U.S. crude oil prices trade well below world prices for a variety of factors, including the shale boom and lower OPEC output. If that gap were to disappear, demand for U.S. oil would probably drop.

For now, booming exports and production have allowed the U.S. energy industry -- and its hurting workforce -- to rebound from the crash of two years ago. That means more jobs and stronger economic growth.

But if oil prices get too high and gasoline prices follow, American drivers may be annoyed about that crude getting shipped overseas. In addition to crude oil, the U.S. exports about 2 million barrels per day of gasoline and diesel each day.

The average gallon of gasoline sold for $2.57 a gallon on Friday, according to AAA. While that's still relatively low, it is up from $2.29 a year ago -- and Kloza expects gas prices to keep climbing.

"You may start to hear people scream about it when gas prices inevitably march higher," he said.