Pan American World Airways yesterday announced it had reached a definitive agreement to merge with National Airlines, and - in a surprise development - also said it would soon end its service to Moscow and some major cities in Europe to save money.

New York-to-Moscow service was inaugurated simultaneously in 1968 by Pan American and the Soviet state airline Aeroflot, after 10 years of tricky negotiations.

At the time, the service represented an important, if symbolic, commercial link that ushered in a period of detente after decades of Cold War between the two superpowers.

But Pan Am, the only U.S. airline to serve Russia, has rarely made money on the route.

"It depends on how the accounting is done," a Pan Am spokesman said. "it was another day (when the service was started), and we thought we could make a go of it. It was a prestige destination. But the services had dwindled there until, at one point last winter, it was down to only one flight a week."

"We don't see that it represents any political signal to Moscow," said Michael Styles, director of the State Department's office of aviation. He said Pan Am did not consult with the department in advance and "we weren't given the opportunity to object."

He noted that "Pan Am still needs approval of the Civil Aeronautics Board to drop service to any of these points."

Pan Am said that, in addition to Moscow, it will suspend service Oct. 29 to nine other foreign cities - Amsterdam, Paris, Vienna, Lisbon, Ankara, Belgrade, Budapest, Bucharest and Prague - and to Boston and Portland, Maine, in the United States.

"We are redistributing our resources to permit us to increase service on high-demand routes," Pan Am President Dan Colussy said in explaining the restructuring, which represents a major realignment in the airline's foreign route system at the same time it is seeking domestic routes for the first time through its proposed merger with Miami-based National.

If the $350 million merger deal goes through, it would create the country's second largest airline, behind United Airlines, with revenues that would total about $2.5 billion in 1978.

The last major merger between two financially healthy airlines was in 1961, when United acquired Capitol Airlines.

But the Pan Am-National deal faces a number of significant hurdles.

It must be approved by National's shareholders, who have to decide whether to accept Pan Am's offer of $41 a share for their stock.

The merger also must be blessed by the CAB and President Carter - who has the final say on all matters involving international aviation - at a time when the regulatory agency and the administration are trying to increase competition among airlines.

Meanwhile, there is a competing takeover bid for National by Houston-based Texas International Airlines, which has already acquired about 12 percent of National's shares at an average price estimated at about $20.

Pan American closed yesterday on the New York Stock Exchange at 9 3/4, up one half, and National Airlines was ahead 1/8 to 34, both on heavy buying.