President Obama will endorse a bill to repeal a law that limits the legal definition of marriage to a union between a man and a woman, the White House said on Tuesday, taking another step in support of gay rights.

Jay Carney, the White House press secretary, said Mr. Obama was taking the additional step away from the Defense of Marriage Act — which the administration said earlier this year it would no longer defend in court — to “uphold the principle that the federal government should not deny gay and lesbian couples the same rights and legal protections as straight couples.”

If the measure passes, it would make same-sex couples eligible for certain federal benefits that have previously been available only to heterosexual married couples.

The new legislation, which is being sponsored by Senator Dianne Feinstein, Democrat of California, is unlikely to pass Congress this year, but will nonetheless face its first committee hearing on Wednesday in front of the Senate Judiciary Committee.

“More and more people across this land know people who are gay, who want to have a lasting relationship, who look at marriage as an economic agreement as well as an emotional agreement,” Ms. Feinstein said in remarks at the National Press Club. “I think eyes have opened.”

The Obama administration in February said it would no longer defend the Defense of Marriage Act in legal proceedings, and Attorney General Eric H. Holder Jr. said for the first time that Mr. Obama believed that the act was unconstitutional.

The president has said in the past that he opposes same-sex marriage on religious grounds; as a Christian, he has said, he views marriage as a union of a man and a woman. But the White House has said more recently that the president’s views on the issue are “evolving.”

Mr. Obama ran for office promising to be a fierce advocate for the rights of gay people, and proponents of gay rights say that in many respects, he has delivered. Besides his decision to no longer defend the Defense of Marriage Act, he signed a new hate crimes law and pushed Congress to allow gay men and women to serve openly in the military.