The outcome is clear for people who were married and live in states that allow same-sex marriage. They now are eligible for federal benefits.
The picture is more complicated for same-sex couples who traveled to another state to get married, or who have moved from a gay marriage state since being wed.
Their eligibility depends on the benefits they are seeking. For instance, immigration law focuses on where people were married, not where they live. But eligibility for Social Security survivor benefits basically depends on where a couple is living when a spouse dies.
The rulings came 10 years to the day after the court's Lawrence v. Texas decision that struck down state bans on gay sex. In his dissent at the time, Scalia predicted the ruling would lead to same-sex marriage.
Massachusetts was the first state to allow gay couples to marry, in 2004. When same-sex unions resume in California, there will be 13 states representing 30 percent of the U.S. population where gay marriage is legal.
The other 11 are Connecticut, Delaware, Iowa, Maine, Maryland, Minnesota, New Hampshire, New York, Rhode Island, Vermont and Washington.
Outside the court, gay marriage proponents celebrated both wins.
May the marriages begin," said the Human Rights Campaign's Chad Griffin, who helped spearhead the lawsuit challenging Proposition 8. The two same-sex couples who sued for the right to marry also were at the court Wednesday.
In New York City's Greenwich Village, the Stonewall Inn, where a riot in 1969 sparked the gay rights movement, erupted in cheers and whooping.
Mary Jo Kennedy, 58 was there with her wife Jo-Ann Shain, 60, and their daughter Aliya Shain, 25.
She came with a sign that could be flipped either way and was holding up the side that says "SCOTUS made our family legal".