Retired Navy Rear Adm. Thomas Starr King Jr., 66, who commanded the recovery-at-sea operations for two astronauts during the Mercury manned space flight program, died Thursday at Coronado Hospital in Coronado, Calif., after a heart attack. He lived in McLean.

Adm. King was born in Wilmington, Del., the son of a Navy captain. He grew up at various military installations and graduated from the U.S. Naval Academy at Annapolis in 1936. He later earned a master's degree in electrical engineering at the Massachusetts Institute of Technology.

During World War II, Adm. King served aboard the curiser Wichita on convoy duty in the North Atlantic and then in the Pacific. Later in the war, he served aboard the battleship Alabama.

After the war, Adm. King's assignments included command of the U.S.S. Observation Island, a ship that was used during the testing of the Polaris missile. He also commanded the ships assigned to recover astronauts Walter Schirra and Gordon Cooper. Their space flights aboard Mercury capsules came down in the Pacific.

At the time of his retirement in 1970, Adm. King was deputy commander of the Military Sealift Command with headquarters in Washington. While stationed here, he established his home in McLean.

After leaving the Navy, Adm. King moved to Portland, Ore., where he was general manager of a local government transportation agency until about 1976, when he retired a second time and returned to McLean. He was vacationing in California at the time of his death.

The admiral's military decorations included two Legions of Merit.

Survivors include his wife, the former Dixie Friedrichs, of McLean; two sons, Thomas Starr IV, of Woodbridge, and William K., of Vienna; one daughter, Anne Stuart King of Bethesda; one brother, retired Navy Rear Adm. Randolph W. King of Arnold, Md.; two sisters, Mrs. E. H. Batcheller and Mrs. J. P. M. Johnston of Washington, and three grandchildren. Also surviving are six stepchildren.