James D. Lee, 39, a Foreign Service officer in the State Department who specialized in commercial and economic affairs, died of cancer Thursday at Fairfax Hospital.

Mr. Lee joined the Foreign Service in 1969. His posts abroad included Oslo, Norway, where he was a consular officer, and Toronto, Canada, and Prague, Czechoslovakia, in both of which he was an economic-commercial officer. For the past two years, he had been working in the State Department's bureau of economic and business affairs.

A native of Mebane, N.C., Mr. Lee earned a bachelor's degree in journalism at the University of North Carolina at Chapel Hill in 1963. He was a reporter on the Gastonia (N.C.) Gazette until 1964, when he went into the Army. He was stationed in the Washington area and decided to remain here when he left the service in 1966.

Mr. Lee was a computer programmer at the Navy Department in 1966 and 1967 and then went to work as a computer programmer for the General Electric Co. He then joined the Foreign Service.

In 1974, Mr. Lee earned a master's degree in history at George Washington University.

He was a resident of Falls Church and a member of the Falls Church Episcopal Church. He also was a member of the Foreign Service Association.

Survivors include his wife, Elizabeth D'Zmura Lee, and a daughter, Elizabeth North Lee, both of Falls Church, and his mother, Annie K. Lee of Mebane.