The West German government, reeling from a major spy scandal, struck a counterblow today by announcing the defection of a senior East German diplomat posted in Buenos Aires.

The diplomat, Martin Winkler, 44, was described as one of East Germany's most experienced specialists in Latin American affairs. He had served in Havana and as head of the Foreign Ministry's Central America desk before becoming the charge d'affaires in the Buenos Aires embassy in 1981, officials here said.

Western diplomats said Winkler is thought to have worked for some years as a West German double agent. It is believed he feared exposure by Hans Joachim Tiedge, the West German counterspy who sought asylum last week in East Berlin. Tiedge was in charge of tracking East German spies, and Bonn officials are worried that he will jeopardize important Soviet Bloc contacts working undercover for West Germany.

In the nervous atmosphere enveloping Bonn's espionage crisis, the federal prosecutor's office said that another senior member of the beleaguered counterintelligence service was detained for several hours today on suspicion of being an East German agent.

Officials said that Reinhard Liebetanz, 48, a department head assigned to watch right-wing extremists, was released after questioning because there was no longer any "urgent suspicion" that he was acting as a Communist spy. But they said they were still investigating whether Liebetanz had provided information to an East German agent, his friend for 11 years.

Officials in Chancellor Helmut Kohl's government, eager to dispel the image that the country was helplessly besieged by Communist spies, contended that the defection of the East German diplomat showed that Bonn could also take the offensive in the shadowy intelligence world.

Government spokesman Juergen Sudhoff said Winkler had arrived in West Germany Sunday and was being debriefed by intelligence authorities. Sudhoff refused to acknowledge that Winkler's move was related to Tiedge's defection.

Security sources said that the likelihood that Winkler knew the names of key East German agents in Latin America will compel East Berlin's intelligence authorities to revamp their operations in that part of the world. The sources said Winkler's knowledge of East Germany's connections with Cuba should prove especially valuable and would be shared with the United States.

Winkler ranks as the most senior East German to defect since 1979, when Werner Stiller, a lieutenant in East Germany's intelligence service, fled to West Berlin. His information led to the arrest of 17 East German spies and caused 15 others to bolt their cover and seek sanctuary across the border.

The prosecutor's office said Liebetanz's close friend, a man named Eberhard Severin, had been exposed as an East German spy infiltrated into the West in the 1960s.

Liebetanz reported to his office that Severin only revealed his true identity as an East German spy when the two vacationed together in Austria last week. He said Severin was joined by another agent, who tried to persuade him to defect to the East.

Liebetanz said he urgently notified Austrian police before returning to his home in Cologne. Austrian authorities said they were looking into the case but were reported to believe that both of the alleged agents had probably fled back to East Germany.

The prosecutor's office initially perceived Liebetanz's account as a possible attempt to disguise his own tracks as a double agent and took him into custody to thwart his potential escape to the East. But after preliminary interrogations, security officials said they found sufficient proof to support his story.

Nonetheless, investigators said they still wanted to pursue the case to determine whether Liebetanz conveyed sensitive information to the East German agent during their long acquaintance. Liebetanz is the sixth spy suspect to come under investigation since the disappearance of Sonja Lueneburg, the long-time private secretary of Economics Minister Martin Bangemann.

Security officials said a continuing inquiry into the case of Margarethe Hoeke, a secretary arrested last weekend on charges of spying for many years in the office of West Germany's president, had produced evidence that she had gained greater access to top-secret material than previously believed.

Hoeke is said to have learned many details about the Bonn government's secret command bunker under the Eifel Mountains and about plans for running the country in wartime.

The latest developments occurred just hours after Kohl officially declared a personnel overhaul in the intelligence hierarchy, shaken by Tiedge's betrayal.

The Chancellery announced that Heribert Hellenbroich, the former head of the counterintelligence service known as the Office for the Protection of the Constitution, was dismissed from his new post as chief of foreign intelligence because he bore responsibility for the scandal. Hans Georg Wieck, Bonn's ambassador to NATO, was appointed as Hellenbroich's replacement.