A landmark national election apparently has assured the military continued control of Brazil's federal government while tempering 18 years of authoritarian rule with broad new powers for opposition parties.

After five days of slow processing of the more than 55 million ballots cast in Monday's election, unofficial returns today showed the government leading in 14 of 23 state elections over an opposition split into four different parties.

The incomplete results also appear to be propelling the military-backed Social Democratic Party to a majority in the special electoral college that is to choose Brazil's next president in January 1985. Political analysts here said the control over the powerful presidential position would allow the military to retain ultimate power until 1991.

Despite these government gains, the election results are expected to initiate a new political era here by turning over control of the richest and most powerful state governments to opponents of the military--ranging from the moderate center to the socialist left.

Election analysts now expect opposition leaders to take governorships in at least seven states holding about 75 percent of the country's economic wealth. They also say opposition representatives, taken together, will hold a majority in the National Congress' lower House of Deputies.

Centrist opposition leader Franco Montoro was elected governor in the most important state, Sao Paulo, and Rio de Janeiro's election was tilting toward Leonel Brizola, a socialist and brother-in-law of the president deposed by the military in 1964.

While the power of the new opposition governors and congressmen will be limited by the extensive authority of the president, Gen. Joao Figueiredo, and the central government, opposition leaders and analysts believe that the military will now be obliged to negotiate major political and economic policies with the opposition.

The victorious opposition leaders say they will be able to press for an acceleration of Brazil's widely watched process of abertura, or opening to democracy, which has slowly moved the country away from strict dictatorship. "There is a generalized conviction in this country that Brazil will not be the same from now on," said Brizola as the votes were counted.

Government spokesmen have endorsed the election results, but political leaders remain unsure of the military's reaction to the opposition victories in the big states. While military authorities are not expected to block opposition winners from taking office in March, some analysts fear victories of old leftist adversaries and subsequent conflicts over economic and social policies could provoke a reversal in the democratic movement.

The ultimate balance of power will likely have an important influence on other countries in Latin America, where Brazil has emerged as the main industrial power in recent years. The success of the political process is also of strong interest to the United States, which regards Brazil as a model of political stability in a turbulent region. President Reagan is scheduled to visit Brazil on his four-nation trip starting Nov. 30.

The government's overall lead in the elections for some 56,000 state, congressional and local authorities comes in large part from Brazil's rural areas and poverty-stricken northern states. There, opposition party organization was relatively weak and local officials won support for the government ticket by promising federal aid for development or help for drought-stricken farmers.

Across the country, the government's party, a coalition between the military and political and business groups that support it, benefited from electoral laws -- including mandatory voting by straight-party tickets and a ban on party coalitions.

Figueiredo's government also changed the rules this year for the membership of the presidential electoral college, which is now to be composed of the new Congress and an equal number of representatives from each state. As a result, a vote in the remote Amazonian region of Acre will have more than 20 times the weight in the presidential selection as a vote from the economic heartland of Sao Paulo.

Despite these advantages and extensive campaigning by the popular Figueiredo, the government's support apparently evaporated in the populous southern coastal states. Urban voters were preoccupied with the sagging of the economy after years of boom, bringing three-digit inflation and increasing unemployment.

In particular, military officials have been stunned by the projected victory in the state of Rio de Janeiro by Brizola, a state governor in the early 1960s who was then known as a militant leftist and who attempted to organize armed resistance to the military takeover.

So far, government officials have refused to acknowledge Brizola's victory and though independent projections have shown him holding a five-point advantage over the government candidate, the outcome of the race today remained in doubt.

By this morning, Rio's electoral board had released official results totaling only 1.4 percent of the state's 11,000 voting boxes, and as government officials hinted of a surprise upset, an alarmed Brizola warned that the government may try to manipulate him out of office. "Only fraud will prevent our victory in these elections," he said in a meeting with foreign correspondents on Thursday.

Although Brizola has moderated his socialist politics and pledged to cooperate with military authorities, his relations with the federal government are expected to be a key to Brazil's new political balance.

Brizola, if elected, and the opposition leader in Sao Paulo, Montoro, will control tens of thousands of government jobs and a wide range of key state enterprises, including railroads, steel mills, several of Brazil's largest banks and even supermarket chains.

At the same time, the new opposition governors, who will be the most powerful officials outside of the military party, will have to depend on the central government to supply them with budget funds and will have only partial control over the local security and police forces.

Some analysts see a crucial test for these delicate political relationships developing in the coming months, when the government is expected to take severe measures to bring the economy and $80 billion foreign debt under control.

"A confrontation could develop over the handling of a strike by an opposition governor, and the Army might start to feel the situation is out of control," said Alexandre de Barros, a Brazilian political scientist.

Leaders of the main opposition party, the Brazilian Democratic Movement, discount these fears and say they plan to launch a campaign soon after the elections to persuade the armed forces to hold direct elections for president in 1985, in place of the weighted electoral college.

With the government's hold on that presidential vote and a majority of state governments now apparently secure, however, political analysts here say the opposition can at best hope for a civilian president chosen by the military and government accommodation on important national policies.

"What we can expect is that the government will have respect for its opposition for the first time," said Fernando Gasparian, a Democratic Movement leader. "This is not yet a democratic country, but the people will begin to see what a democracy will bring."