Oil ministers of the Organization of Petroleum Exporting Countries agreed today that a pact on oil prices and production quotas thrashed out in London in March is working well and that the cost of oil is likely to remain stable until autumn.

But the quickening pace of economic recovery and the desire of non-OPEC oil producers to step up oil exports could force the 13-member cartel to reshape its strategy soon to try to reassert control over the market, the ministers said.

So far, the OPEC members have successfully gained cooperation from rival producers, such as Britain, Mexico and the Soviet Union, to prevent any erosion of the organization's benchmark price of $29 a barrel.

As the winter buying season acquires momentum and western economies recover from recession, however, the scramble for sales could sow new turmoil in the oil markets. Several OPEC members, notably Nigeria and Venezuela, desperately want to boost oil revenues to relieve enormous debt burdens.

"The task before us is how to react to the expected increase in demand for oil," said Nigeria's oil minister, Yahaya Dikko. "The problem is to organize and share the market with non-OPEC producers, or we will all lose."

Oil ministers meeting here hope to resolve the issue of who will become the next secretary general of the cartel, succeeding Gabon's Marc Nguema, by Tuesday. Iran is claiming the right to nominate his successor to the not very powerful position under an alphabetical system of rotation. Iraq, its foe in the Persian Gulf war, has nominated a rival candidate.

Besides the nascent economic recovery, the rising demand for oil is rooted in the fact that many major oil companies had depleted their reserves sharply during 1982 and early 1983 in the months of pent-up anticipation of a substantial price cut. The accord reached by OPEC at a special meeting in London in March clearly encouraged oil companies to replenish their stocks and prepare for heavy consumption during the winter months.

The London meeting, which set an overall production ceiling this year of 17.5 million barrels a day and cut the basic price of oil by $5 to $29 a barrel, settled nearly two years of squabbling within OPEC caused by a global glut and slumping demand for the cartel's high-priced crude.

Recognizing that a price war could prove ruinous to their economies, the 13 OPEC members generally have stuck to their quotas and curtailed the cheating, or furtive underpricing, that was commonly practiced by Iran, Algeria and Nigeria to boost their oil income.

Only Nigeria has exceeded its quota in recent months, reportedly by 200,000 to 300,000 barrels a day, but industry analysts claimed it was a temporary shift to mop up a short-term decline in British oil production.

Saudi Arabia's oil minister, Ahmed Zaki Yamani, whose country enforces OPEC's prices by raising or lowering its oil output, told reporters tonight that the price and production pact would not be changed "until the next OPEC meeting."

The OPEC ministers are not due to meet again until December in Geneva. There is widespread speculation here, however, that an emergency session to parcel out new quotas and possibly fix a new price may be necessary by the end of September to cope with a possible jump in demand for oil.

At the time of the March accord, OPEC was selling less that 14 million barrels a day. But today, output has increased beyond 17 million barrels a day and several nations are close to their allotted production ceilings, according to the authoritative Petroleum Intelligence Weekly.

In the last three months of this year, demand for OPEC oil may grow to as much as 19 or 20 million barrels a day, industry analysts said.

In that case, new quotas will need to be negotiated to divide up the additional sales and thwart any temptation to dump excess oil at discounts that could lead to a price war.

In addition, OPEC will have to elicit further cooperation from outside producers to defuse threats of competition that could lead to more slippage in oil prices.

Britain, Mexico and the Soviet Union, as well as other non-OPEC oil producers like Egypt and Malaysia, reportedly have displayed signs of willingness to restrict exports once the risk of falling prices appeared detrimental to their national interests.

But the growing number of important non-OPEC nations may become difficult to control later this year if demand picks up and the allure of quick revenues could ultimately prove irresistible to Third World oil producers now badly strapped for cash.

Oil industry specialists here also stressed that economic troubles may compel the Soviet Union, the world's largest oil producer, to exercise less restraint later this year because it badly needs to increase its foreign currency earnings from oil exports.

Figures released in Moscow Monday showed that oil made up 40.2 percent of all Soviet exports last year, accounting for sales of $34.2 billion including oil byproducts, Reuter reported.

Britain, another major producer outside OPEC, is also said to be leaning toward a less cooperative attitude because of Prime Minister Margaret Thatcher's free-market principles.

Moreover, oil analysts say it is still too early to tell how much of the decline in oil consumption is attributable to lasting conservation measures rather than recession-induced cutbacks.

Another unpredictable factor in the oil markets remains the decidedly tenuous nature of a worldwide economic recovery.

While the United States has shown an impressive spurt of growth in recent months, economists are divided about the upturn's staying power.

If U.S. interest rates stay high, the recovery could fizzle and abort hopes for an economic surge in Europe and developing nations.

That, in turn, could trigger a new slump in world oil demand, intensifying pressures on OPEC countries to submit to a new round of price cuts.