All in all, it’s been a pretty good week for Nicolás Maduro, the embattled and unabashedly gauche president of Venezuela.

Yes, there were food riots a few blocks from the presidential palace that were broken up with tear gas and pro-government motorcycle gangs. But Maduro notched an apparent win amid an attempt to censure his government by Luis Almagro, the secretary general of the Organization of American States (OAS), as key member countries demonstrated little support for strong action at a meeting this week. This after Maduro crudely told Almagro to roll up the OAS charter and do something undiplomatic with it.

Maduro says such things all the time. But this week he had a little more smirk in his taunts. Oil prices are up again, and that means Maduro is, too.

The price of Venezuela’s crude basket rose to nearly $40 on Thursday, its highest point in more than six months and a 60 percent increase from its February average. World petroleum prices are forecast to continue climbing this year and next.

With every increase, the chances that Maduro will survive increase a little more, too. If he can hold on long enough, he will reap the benefits of an oil rebound and improve his chances to finish his term through 2019. His entire political strategy appears to be banking on it.

Because Venezuela, the world's 12th-largest petroleum producer, isn’t a normal country. It is a place where virtually all money and power emanate from a single source, like some sort of enchanted — or cursed — kingdom with a magic crystal.

More than 95 percent of the country’s trade revenue comes from petroleum exports, and since Venezuela produces little else, much of its food and other basic goods must be imported. Because Maduro controls the state oil monopoly PDVSA, he also controls the dollars it earns, and therefore he controls the levers for just about everything else.

For the past year or more, Maduro has been scraping the bottom. His government has survived by taking on staggering amounts of debt, burning up its foreign currency reserves and slashing imports — including food. This has led to scarcities and staggering supermarket lines that represent a mortal threat to Maduro and the “Bolivarian” revolution he inherited from the late Hugo Chávez, who benefited from a lot more charisma and a lot more $100 barrels of oil.

The spontaneous riot that erupted Thursday happened when armed government supporters tried to cut into a food line outside a grocery store, according to the Associated Press. Reporters who arrived at the scene were beaten by national guard troops and men who appeared to be plainclothes agents.

The show of force was a sign of just how sensitive the food lines have become for the government, which is waiting for oil prices to climb.

If they do, Maduro can put more food on the supermarket shelves. He’ll have more money to secure the loyalties of state employees, or to pay for tear gas canisters and the salaries of national guard troops who launch them. He can bring in medicines, diapers, beer, toilet paper, coffins, chicken, banknotes, Coca-Cola and some of the zillion other items that Venezuela is running out of.

Maybe he’ll even get new credit lines and be able to meet the scheduled payments this fall that have raised worries of a default on Venezuela’s more than $120 billion foreign debt.

But oil means even more than that. It’s a psychological factor. When oil prices go up, so does the confidence of Venezuela's leaders.

Maduro’s approval ratings have dropped below 30 percent, according to polls, but more oil revenue could help him win back frustrated former Chávez supporters who dislike him but remain unconvinced by the alternatives.

The political opposition continues to struggle to draw large crowds to its marches as it attempts to channel the food lines into a protest movement.

But Maduro’s hole is a deep one, and it’s not clear how much oil prices need to rise to pull him out of it. If oil prices don’t increase fast enough, he may run out of time.

This week, four BP tankers with 2 million barrels of U.S. oil were parked off the Venezuelan coastline, unable to offload because they haven’t been paid. Three of the tankers have been sitting there for more than a month, according to Reuters.

Venezuela’s thick, sulfurous crude is so heavy that it has to import high-quality “light” oil to blend with its own. In other words, even Venezuela’s oil needs oil in order to make money.

And if Maduro can’t even export the oil Venezuela has, no increase in prices will save him.

Clarification: This post has been updated. OAS member states have yet to vote on Almagro's attempt to censure Maduro's government and potentially suspend Venezuela from the regional body. A vote is due to be held later this month, but has not been scheduled. An OAS meeting, convened by Argentina, produced a consensus statement Wednesday calling for "dialogue" between the Maduro government and Venezuela's opposition.

Read more: