The president and first lady Michelle Obama hosted a barbecue and concert for more than 1,200 service members and their families. Afterward, they were treated to a concert by a Marine Band and the Grammy award-winning band FUN.
Obama thanked those he called "military heroes" for upholding American values around the world.
"People in scattered corners of the world are living in peace today, free to write their own futures, because of you," said President Obama.
The president recalled the bravery of what he termed "a small band of patriots" who declared America's independence in 1776, pledging their "lives...fortunes and...sacred honor." He paid tribute to "this improbable experiment in democracy" and its commitment to peace and freedom.
"And what makes us great is not our size or our wealth but our values and our ideals and the fact that we are willing to fight for them," said Obama.
A short distance away, tens of thousands gathered on Washington's National Mall for a concert and a huge fireworks display visible over much of the city.
A similar crowd gathered in Boston, Massachusetts for the traditional concert by the Boston Pops. Security was tight for the city's first major public event since the Boston Marathon bombings in April, in which three people were killed and hundreds wounded.
One of the nation's most prominent celebrations was in New York City, where the Statue of Liberty reopened, eight months after being damaged in a hurricane.
At the ceremony, the city's mayor, Michael Bloomberg, reflected on the statue's significance to generations of immigrants arriving in New York.
"Lady Liberty, whose welcome to all is "to all who yearn to breathe free" is just, I think, like the Fourth of July. It's at the heart of what America really is all about," he said.
Protests against government surveillance were held in a number of U.S. cities. Activists spoke against recent disclosures that the National Security Agency has been secretly tracking phone calls and Internet activity.
Thursday also marked the first day of a weeklong series of naturalization ceremonies, in which almost 8,000 immigrants became U.S. citizens.