Eight of the White House's Republican foes backed the change -- perhaps the biggest such shift in the US military since racial integration began in 1948 -- while three Republicans and one Democrat missed the vote.
The measure, whose passage was assured when it cleared a procedural hurdle by a 63-33 margin earlier, fueled bitterly divisive debate in the already polarized Senate.
"The first casualty in the war in Iraq was a gay soldier. The mine that took off his right leg didn't give a darn whether he was gay or straight. We shouldn't either," Democratic Senator Carl Levin said before the ballot.
"We cannot let these patriots down. Their suffering should end. It will end with the passage of this bill. I urge its passage today," said Levin, who chairs the Senate Armed Services Committee.
"It isn't broke, don't fix it," countered Senator John McCain, the top Republican on Levin's panel and Obama's defeated 2008 White House rival and a fierce foe of lifting the ban.
"To somehow allege that it has harmed our military is not justified by the facts," McCain said. "Don't think that it won't be at great cost."
Passage triggered a time-consuming process that calls for lifting the ban only after the president, the secretary of defense, and the top US uniformed officer certify that doing so can be done without harming military readiness, effectiveness, unit cohesion, recruiting and retention.
Republicans have scoffed that the leaders involved have already stated their support to ending the policy.
"They have already made up their minds," said Republican Senator James Inhofe.
The Pentagon issued a study this month that found a solid majority of troops were not bothered by the prospect of lifting the ban and that the military could implement the change without a major disruption or upheaval.
The repeal effort enjoyed broad support from the US public, as well as from Defense Secretary Robert Gates and US Joint Chiefs Chairman Mike Mullen.
Gates -- who had warned that US courts would step in and perhaps force a hasty end to the policy unless lawmakers acted -- said the Pentagon would "carry out this change carefully and methodically, but purposefully."
Mullen, whose emotional February testimony to Congress in favor of repeal has been credited as a signal moment, said ending the ban was "the right thing to do."
"No longer will able men and women who want to serve and sacrifice for their country have to sacrifice their integrity to do so," he said, promising: "We will be a better military as a result."
In the years since the ban was enacted as a compromise, some 13,000 US troops have been ousted, and critics have pointed out that many were trained at great expense, like fighter pilots, or had hard-to-find skills, such as Arabic translators.
But opponents of the legislation have cited testimony from US military service chiefs who warned against a quick repeal, citing concerns about unit cohesion.
General James Amos, commandant of the Marine Corps and an opponent of lifting the ban, has warned repeal could jeopardize the lives of Marines in combat by undermining closely knit units.