The administration said it will no longer defend the federal law that defines marriage as only a union between a man and a woman.
The Justice Department had defended the Defense of Marriage Act (DOMA) in court until now.
The announcement was made in a letter from Attorney General Eric Holder to congressional leaders.
Obama "has made the determination," Holder wrote, that Section 3 "as applied to same-sex couples who are legally married under state law, violates the equal protection component of the Fifth Amendment."
The move quickly drew praise from some Democrats in Congress but a sharp response from the spokesman for Republican John Boehner, the House Speaker.
"While Americans want Washington to focus on creating jobs and cutting spending, the president will have to explain why he thinks now is the appropriate time to stir up a controversial issue that sharply divides the nation," said Boehner's spokesman Michael Steel.
In polling by ABC News and the Washington Post, support for the legalization of gay marriage has climbed from 37 percent in 2003 to 47 percent in February 2010.
At the White House, spokesman Jay Carney said Obama himself is still "grappling" with his personal view of gay marriage but has always personally opposed the Defense of Marriage Act as "unnecessary and unfair."
Legal experts say the change of policy by the president does not automatically mean same-sex marriage is legal throughout the U.S. That will be left for the courts or Congress.
Jon Davidson is legal director of the non-profit Lambda Legal, which supports same sex marriage.
"They're saying we should be suspicious of laws that discriminate based on sexual orientation because they are likely to be based on prejudice, rather than legitimate reasons," Davidson said.
Andrew Pugno of protectmarriage.com issued a statement critical of the Obama administration's decision.
"The president's abandonment of DOMA just further shows the disconnect between the will of the people and government authorities," Pugno said. "It also shows the enormous politcal power of gay rights advocates."
ABC News and the Associated Press contributed to this story.