India's combined opposition swept to the biggest election upset in the nation's history today, gaining a majority of seats in the new Parliament and ending the congress Party's 30-year hold on power.

Prime Minister Indira Gandhi, her own seat lost in the surge led by the four-party group know as the People's Party, announced through her spokesman that she would resign today.

As state after state rejected the party that led India to independence, jubliant spokesmen for India's new rulers said that among their first actions would be steps to roll back restrictions on press freedoms and individual rights that had been writen into law during the 21-month state of emergency that ended yesterday.

Hundreds of Indians who remained in jail under emergency regulations were freed by state governments.

The People's Party and its allies went over the 272 mark in the 542-seat Parliament early this morning with 90 seats still to be declared. It appeared possible that the People's Party alone, formed only two months ago by four-non-Communist opposition groups when Gandhi announced the snap elections, could win a majority and form a government.

More likely is a coalition headed by Morarji Desaithe, 81-year-old ascetic and follower of the late Mahatma Gandhi. Speculation for the post of deputy premier centered on Jagjivan Ram, the leader of India's 80 million Untouchables and head of the new Congress for Democracy.

Spokesmen for the parties said they would work together in Parliament.

In tense maneuvering appeared to be under way for other spots in the new government, which is expected to be announced on Thursday.

People's Party spokesman said that the new government would free all remaining political prisoners, repeal all laws containing restrictions on the press, remove bans on various social and cultural organizations prohibited at the start of the emergency and insure that no one is jailed without trial.

It was these aspects of Gandhi's emergency rule, along with highly unpopular sterilization and slum clearance drives pressed by the prime minister's son Sanjay, that led to the landslide defeat for the Congress Party. It had won two-thirds of the seats in the 1971 elections.

Not only were the prime minister and Sanjay defeated, but at least a half-dozen Cabinet ministers also lost their seats, particularly those who were most closely identified with the emergency rule.

After losing her parliamentary seat, Gandhi called a Cabinet meeting and decided to ask acting President B. D. Jatti to revoke the emergency regulations. Several laws remain on the books, however, including an internal security act permitting detention of persons for up to two years without trial, and they would have to be repealed individually by the new Parliament.

A spokesman for the prime minister first announced early yesterday that she was ready to submit her resignation, but then there was a delay and another announcement that she would resign today. Jatti is expected to ask her to form a caretaker government that will rule until the new government takes over, probably this weekend.

For Gandhi, then, a political career that began during the independence movement and included 11 years as prime minister, appears to be in its last days.

The Congress Party is expected to elect a new chairman, with speculation centering on Foreign Minister Y. B. Chavan, who retained his seat in Parliament, or perhaps a new face from southern India, where the party maintained a considerable hold on the electorate.

Congress Party sources blamed their losses primarily on the government's intense sterilization drive during the emergency.It was pressed hardest in northern India, where rioting broke out in a number of towns, and it was throughout this politically crucial region that the party suffered defeat after defeat.

Throughout the campaign, Gandhi claimed that the Peole's Party would fall apart after the balloting, but Mohan said yesterday that the party and its allies in Ram's Congress for Democracy had agreed to form "one single parliamentary group, pick one leader and have one united government with participation by all members."

"This is the country's finest hour," said Desai. "India has been vindicated. With any other election result, the world would have lost respect for this country. God has been kind."

[In Washington, White House Press Secretary Jody Powell said the lifting of the State of emergency "is to be welcomed." He declined to comment on the outcome of the balloting.]

The emergency was imposed in June 1975 after opposition groups led by Jayaprakash Narayan, the ailing Gandhian who remains a driving force behind the People's Party, mounted a campaign calling for Gandhi's resignation when a court found her guilty of election malpractice in the 1971 elections.

Both Desai and the man who challenged her in the courts, Raj Narain, were jailed during the emergency. It was Narain who defeated Gandhi by nearly 55,000 votes in her Rai Bareli district in the election just ended. Desai won his election in Gujarat State by 21,000 votes.

Other prominent Gandhi Cabinet members who were defeated include Information Minister V. C. Shukla, who engineered the crackdown on the press; Law Minister H. R. Gokhale, who drew up the main ordinances restricting civil liberties and press freedoms; and Defense Minister Bansi Lal, close friend of Sanjay.