Crude oil prices–and the shares of U.S. oil and gas companies–surged over 8% Wednesday as the Organization of Petroleum Exporting Countries (OPEC) agreed to cut its output by some 1.2 million barrels a day to end a global glut.

If fully implemented, the deal will effectively end the price war started by Saudi Arabia two years ago in its efforts to wrest market share back from U.S., a ploy that has wrecked the budgets of many OPEC members including Saudi itself.

Crucially, the deal is dependent on persuading major non-OPEC producers such as Russia to cut output too, by a total of 600,000 barrels a day. Moscow, having previously said it would only freeze production at current (record high) levels, has now committed to cut by 300,000 barrels a day, OPEC President and Qatari Energy Minister Mohammed Saleh al-Sada told a press conference in Vienna after the meeting.

Al-Sada said that Saudi Arabia would take the biggest hit, cutting by 486,000 barrels a day to just over 10 million. Reuters reported that Iran, Saudi’s biggest rival in the cartel, had agreed to freeze its output close to current levels, which would represent a major diplomatic coup for the Islamic Republic in the face of heavy Saudi pressure to share the pain.

“We believe it is very much achievable,” al-Sada said.

But the actual cut isn’t as big as OPEC would like to present it. The cartel has simply stopped counting the 750,000 barrels a day produced by Indonesia, on the grounds that it is no longer an oil exporter. And there is no way of knowing how Russia will measure its contribution yet. In the past it has merely chosen to defer planned output increases.

The exact production quotas are still to be published.

Shares in the biggest U.S. shale producers exploded on the deal, as the threat of a longer price war receded. EOG Resources eog , Apache Corp spa , and Chesapeake Energy chi all rose by over 8% on the news. Conventional heavyweights ExxonMobil xom , Chevron cvx , and Conocophillips cop also gained strongly, lifting the S&P 500 to a new record high. At midday, the benchmark futures contract for U.S. crude was up 8.5% to $49.08, which was a five-week high.

“I don’t think this means that we’re going back to a world of $100 oil or even $75 oil, but it does mean that we’re not going back to a world of $28 any time soon,” Andy Brogan, global oil and gas transaction leader at EY, told Fortune.

As a result, shale companies can be more confident about drilling, and banks can be more confident about lending to them, Brogan said. The key variable, he noted, will be how quickly, and how cost-effectively, the industry can do that–given that the carnage in the oil services sector since 2014 has “hollowed out” the supply chain.

If the cut sticks, then the International Energy Agency reckons that the world market could “move from surplus to deficit very quickly in 2017,” leading prices to rise sharply once the existing stock overhang is depleted.

The question is, though, will it stick? Or will a reviving shale industry simply enjoy a free ride on OPEC’s discipline?

“If you get to the next OPEC meeting and all that has happened is that shale has replaced the entire cut, then there is a risk that they’ll think again,” EY’s Brogan said.