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 cur9qguarantee 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."