As gasoline supplies ran dry in much of the country, Venezuela's highest court indicated today that a crippling strike at the national oil company was illegal, handing President Hugo Chavez a timely victory against the organized opposition seeking to push him from power.

The temporary ruling, on Day 18 of a punishing national strike, outlawed the opposition's most potent political weapon as it tries to force Chavez to resign or hold early elections. But with government opponents vowing to continue the strike, it seemed unlikely to resolve a deepening political and social crisis that Venezuela's government appears increasingly incapable of managing.

Oil workers and dissident executives, some of whom have been fired by Chavez during the strike, said tonight they will not comply with the order to return to work. Citing what they describe as Chavez's authoritarian rule, they have claimed a constitutional right to close the company, Petroleos de Venezuela, which provides the government with $9 billion a year -- almost half its revenue -- and the United States with 15 percent of its imported oil.

The court ruling undermined the constitutional claim and gave Chavez fresh evidence for his assertion that a group of executives opposed to his program are sabotaging the company for political gain. The oil strike has cost the government $40 million a day since it began and deepened the political conflict that has consumed this country of 23 million for much of the year. The order applies until the high court formally rules on the strike's legality, which could come within days.

"The order is very clear, categorical: Go back to work," Vice President Jose Vicente Rangel said.

Employees from top executives to tanker captains have taken part in the oil strike, and without them, the protest would have few teeth left. Although the opposition has claimed high participation rates for its protest, the results have been mostly mixed during this peak retail season. In recent days, some shops, restaurants and specialty markets in the wealthy eastern section of Caracas, where people are most opposed to Chavez, have reopened.

The oil strike has reduced Venezuela's 3 million barrel daily production to less than 400,000 barrels, and the potent effects of that reduction could be seen on the streets. Cars were lined up outside some gas stations for what appeared to be more than a mile. Gasoline distributors said 70 percent of gas stations in Caracas, which had been mostly spared from the shortages that have plagued provincial cities, had gone dry.

"Right now we don't have any fuel at all here," said the manager of a large gasoline distributor.

Like many institutions in Venezuela, the high court has become politically suspect as a result of Chavez's four-year effort to produce what he has termed a "social revolution" on behalf of the country's poor majority. But the court has regained some independence over the past year, rendering several key decisions against Chavez since April, when he was briefly ousted in a military-led coup.

Today's decision was based on a suit filed this week by Felix Rodriguez, the oil company's director of production, who claimed the work stoppage was threatening national security. In recent days, Chavez has deployed more than 3,000 troops to protect installations, escort private tank trucks and retake ships in a halting effort to restart the industry.

Some opposition leaders initially indicated that the court had misapplied the law by viewing the oil strike as a labor issue and not a constitutional question of their right to rebel against an unjust government.

Soon after he was first elected in 1998, Chavez helped push through a constitution meant to give Venezuelans more direct political influence after four decades of a hermetic two-party system. Legal analysts say some of the populist parts of the document, written by traditionally opposition politicians who suddenly found themselves in power, have returned to haunt Chavez.

Opposition leaders point to one article in particular to justify everything from daily nationwide street protests to the oil strike. The article allows for Venezuelans to "not recognize any regime, law or authority that contradicts democratic values, principles and guarantees or impairs human rights."