The Mexican government has made a landmark decision to lower trade barriers by committing itself to accepting the rules of the Western world's main international commercial pact.

President Miguel de la Madrid issued a statement late Sunday saying that Mexico would enter the General Agreement on Tariffs and Trade.

It will take months for Mexico to negotiate terms of its entry, and the country probably will have 10 years or more to bring its customs duties and other trade regulations into line with those of the GATT's other members.

But Mexico will have to gradually lower tariffs that raise the price of imports, and to avoid other measures that discourage international trade. That represents a historic change in the country's long-term economic strategy of relying on relatively high trade barriers to protect domestic companies against foreign competition.

Mexico is the largest Western nation that is not a member of the GATT. The decision to join marks the biggest step yet taken by de la Madrid to achieve his declared goal of opening up Mexico's economy to the outside world and thus forcing it to become more competitive.

"We cannot isolate ourselves in an increasingly interdependent world," de la Madrid said. "To insert the Mexican economy in world trade on efficient and competitive terms has been one of the structural changes that I have been proposing to the nation since my inaugural message on Dec. 1, 1982." The decision was announced when the president's office gave the Mexican press copies of a message in which de la Madrid ordered Commerce and Industrial Promotion Secretary Hector Hernandez to begin negotiations for Mexico's entry.

The move carries considerable political risk for de la Madrid, Mexican and foreign analysts said.

Manufacturers and labor unions here have opposed entry into the GATT on grounds that the nation's economy was too weak to survive an influx of foreign-made goods. Some companies are likely to go out of business because they cannot compete, and the move is likely to cost thousands of jobs, according to Mexican and foreign trade specialists.

Press reaction this morning was unusually cautious for a country whose editorial writers normally are quick to give uncritical backing to anything that a president does.

"There exists, without doubt, the risk that a too-rapid opening to outside trade currents would result in a weakening of certain portions of the productive apparatus," Mexico's largest newspaper, Excelsior, said in its lead editorial. It said the decision marked "the most important turn in Mexico's foreign trade policy in almost half a century."

On the other hand, the decision is certain to help Mexico in dealings with international banks and the International Monetary Fund over Mexico's $96 billion foreign debt. The international banking community wants the government to make Mexican companies focus more on selling goods abroad to earn foreign exchange to repay the debt.

The U.S. government, which long has favored Mexico's entry into GATT, welcomed the decision in a statement by the embassy here.

"We think it was a good decision. It should facilitate trade between Mexico and other nations of the world, including the United States," embassy spokesman Lee Johnson said. He stressed that the decision "was Mexico's to make," and noted that "the United States welcomes universal participation in the GATT."

Membership in the GATT has been a controversial issue in Mexico for many years. In 1979, the government negotiated terms to join the GATT, but President Jose Lopez Portillo decided against entry at the last minute in 1980.

The 1979 accord with the GATT will serve as the starting point for negotiations in coming months over Mexico's entry, de la Madrid said. He said Mexico would need special safeguards to protect its petroleum and agricultural industries.

Anticipating criticism of his decision, the president noted that the GATT permits special restrictions on imports "if one of its members faces a critical situation."

He argued that Mexico would benefit by joining the GATT because membership would require other countries to guarantee fair treatment for Mexican exports. Membership "can offer Mexico a degree of greater certainty for its export efforts," the president said.

De la Madrid's government already has taken steps to lower trade barriers and thus pave the way for entry into GATT. In July, it dropped the requirement that companies obtain import licenses before buying most goods from abroad. Such licenses generally are barred by GATT, and some critics said at the time that Mexico effectively had joined GATT without formally admitting it.

"GATT is more of a buzzword than anything else," said a Mexican official, who asked to remain anonymous. "It's not a question of getting into the GATT or not getting in. It's a question of how you go about running your economy. It's become more of a political issue than anything else."