Obama spoke after the caskets of the four arrived at Andrews Air Force base in Maryland.
Chris Stevens, the U.S. ambassador to Libya, and three others — Glen Doherty, Sean Smith and Tyrone Woods — died Tuesday during the attack in Benghazi.
A large group of heavily armed assailants stormed the U.S. consulate and set fire to it, angry over a film made in the U.S. that mocked Islam.
Both Doherty and Woods were paramedics and former Navy Seals who were providing security at the consulate. Smith was an Air Force veteran and information officer who had worked for the U.S. State Department for 10 years.
"Sean was respected as an expert on technology by colleagues in Pretoria, Baghdad, Montreal and The Hague," Secretary of State Hillary Clinton told the gathering at the air base.
Clinton continued to pay tribute to the four who died:
"[Smith] enrolled in correpondence courses at Penn State and had high hopes for the future. He leaves behind a loving wife, Heather; two young children, Samantha and Nathan, and scores of grieving family, friends and colleagues. And that is just in this world, because online, in the virtual world that Sean helped create, he is also being mourned by countless competitors, collaborators and gamers who shared his passion."
"Tyrone Woods, known to most as Rone, spent two decades as a Navy Seal, serving multiple tours in Iraq and Afghanistan. Since 2010, he protected American diplomatic personnel in dangerous posts from Central America to the Middle East. Our hearts go out to Tyrone's wife, Dorothy, and his three sons, Tyrone Jr., Hunter and Kai, born just a few months ago, along with his grieving family, friends and colleagues."
"Glenn Doherty, who went by Bub, was also a former Navy Seal and an experienced paramedic. He deployed to some of the most dangerous places on Earth, including Iraq and Afghanistan, always putting his life on the line to safeguard other Americans. Our thoughts and prayers are with Glen's father, Bernard, his brother, Gregory, his sister, Kathleen, and their grieving families, friends and colleagues."
"Over his distinguished career in the foreign service, Chris [Stevens] won friends for the United States in far-flung places. He made those people's hopes his own. During the revolution in Libya, he risked his life to help protect the Libyan people from a tyrant, and he gave his life, helping them build a better country. People loved to work with Chris."
Obama also spoke of the careers and family of the four. He said Stevens "believed in Libya and its people ... and they loved him back."
"There in Benghazi, he laid down his life for his friends, Libyan and American, and for all of us," Obama said.
The president met privately with family members of the fallen before stepping into a hangar at the air base for the ceremony. Marines carried the caskets of each of the Americans from a C-17 cargo plane into, then later carried them to four waiting hearses, as a colour guard led the procession.Suggest a correction