All Argentine troops on the Falkland Islands surrendered last night to British ground forces that had landed 24 days earlier in a campaign to restore their nation's rule, Prime Minister Margaret Thatcher's office announced in London early this morning.

The British statement said the surrender came at 9 p.m. Falklands time 8 p.m. EDT and quoted a message to Thatcher from Gen. Jeremy Moore, commander of British troops on the islands, as saying: "Falkland Islands once more under the government desired by their inhabitants--God save the Queen."

The Argentine government confirmed that it had agreed to halt combat and withdraw its troops from the islands, The Associated Press reported about 4 a.m. today.

Argentina had invaded the islands nearly 11 weeks ago, but yesterday government sources had conceded that its military position appeared hopeless.

The two sides had agreed to a cease-fire earlier in the day after British Marine commandos and paratroopers stormed and captured several key hills 2 1/2 miles west of the Falklands' capital of Stanley. Defense Secretary John Nott said the British watched "large numbers of Argentine soldiers retreating and streaming back into Stanley."

Thatcher's office said that arrangements were being made to assemble the Argentine troops for return to Argentina and that their arms and equipment "were being secured."

Argentina's three-man ruling military junta had met last night to consider its move after the de facto cease-fire was arranged following a meeting between the Argentine commander on the islands, Gen. Mario Benjamin Menendez, and a British officer.

Stanley was Argentina's last major stronghold on the Falklands. About 9,000 British troops had surrounded it on the ground, and a British naval task force had been shelling it from the sea.

Nott said British infantry yesterday morning drove through Argentine defenses and captured Mount Tumbledown west of Stanley, Wireless Ridge to the northwest and Mount Williams to the southwest.

The British advanced on the three hills from Two Sisters Ridge, about five miles west of the capital. They had seized the ridge Saturday in heavy fighting after a predawn surprise attack and placed there 105-mm guns, which pounded the Argentines during yesterday's assault.

In addition, the British most likely had the support of naval gunfire and their Harrier fighter-bombers. Argentina reported that its warplanes--probably small Pucaras--attacked and damaged British helicopters and ground vehicles.

Argentina, which reported the steady British advance in six communiques during the day, said its troops halted British thrusts Sunday and yesterday but later withdrew after fierce fighting.

One communique, while saying that the Argentine troops fought "with great courage and resolve," stressed that they faced "an enemy that exceeds them in numbers, means and technology." The report marked the first time that the military command had described British forces as superior, an advantage that Argentine media reports have blamed on U.S. support for London.

British ground forces have marched and fought their way to Stanley after landing about 60 miles away on the other side of East Falkland Island May 21. They established a beachhead at Port San Carlos and drove east in two columns, one arching through the northern half of the island and the other through the south.

Argentine ground troops had steadily given up ground, and about 1,800 were reported captured. Before combat began, the Argentine force was reported to include many inexperienced conscripts, and it had been isolated from the mainland by a British air and sea blockade. Argentina's Air Force inflicted the most damage on the enemy, sinking four British ships and damaging at least eight in an unsuccessful attempt to break the blockade.

Argentina never has given up hope of regaining the Falklands--350 miles from its mainland and more than 8,000 miles from London--since losing them to a British assault in 1833. After years of what Buenos Aires considered fruitless negotiations with London, Argentine troops invaded unexpectedly on April 2, overpowering a small British garrison at Stanley.

Britain refused to yield without more of a fight, however, objecting to Argentine aggression and citing the desire of the islands' 1,800 residents to remain under British rule. London launched its counterinvasion after seven weeks of diplomatic talks broke down over the key issue of sovereignty. Basically, Britain declined to give the Argentines the guarantee they demanded that they would eventually obtain ownership of the islands.

Argentine President Leopoldo Galtieri yesterday made a last-ditch attempt at a diplomatic solution, sending a message to Pope John Paul II asking for a mutual withdrawal. The British Foreign Office dismissed the proposal, saying the Argentines were the aggressors and should pull out first.

Britain has officially confirmed losing 201 dead in the fighting so far. The Argentines have commented little about their casualties, but reports in Britain estimate that they have lost about 700 dead.

Prior to the start of yesterday's combat, the British and Argentines had agreed to set up a neutral zone in Stanley around its cathedral for protection of civilians and wounded. The move came after two civilians were reported killed and four wounded in the capital.