PORTLAND – Walter Bunce Spencer Jr., a scientist and teacher who worked on the Manhattan Project, died on Oct. 16 at age 88.

Mr. Spencer had recently graduated from Yale University when he went to work on the top secret project, which developed the atomic bombs that were dropped on Hiroshima and Nagasaki in 1945.

He worked at the Columbia University laboratory, which was the first of five labs to work on the atomic bomb.

As a lab technician, he worked on experiments aimed at making chemical reactions work faster, said his son, Walter B. Spencer III of Portland.

A deeply religious man, Mr. Spencer regretted the lives that were destroyed by the bomb and the havoc that nuclear weapons have caused in the world, said his wife, Marilyn Spencer.

“But he always knew it shortened the war a great deal and saved many American lives,” she said.

After working 16 years as a catalysis chemist, Mr. Spencer spent the rest of his career teaching science.

He first taught at the Mt. Herman School in New Haven, Conn., which he had attended while growing up in New Haven.

He later became the head of the science departments at Tilton School in Tilton, N.H., and Loomis Chaffee School in Windsor, Conn.

He was old-fashioned and continued to wear a tie and jacket long after the Loomis Chaffee School dropped its dress code.

“He was a real gentleman always,” Marilyn Spencer said. “He was reserved. Yet when he said something, you better pay attention.”

While his role in the Manhattan Project is noteworthy, it was only a small part of his life story, said his daughter, Mary Lincoln Spencer of South Portland.

“He loved being a teacher and the life the community of the school gave him,” she said. “That is where the focus should be.”

The couple raised four children.

After his retirement in 1991, the couple moved to Portland. There, Mr. Spencer developed a teaching program involving the camera obscura at the Children’s Museum of Portland.

He loved to sing. At Yale, he had been a member of an elite signing group. In Portland, he sang in the choir at the Woodfords Congregational Church.