The US Supreme Court has struck down a law that defines marriage as between a man and a woman only, in a landmark ruling.
The court's 5-4 vote said the Defense of Marriage Act (known as Doma) denied equal protection to same-sex couples.
The decision means that legally married gay men and women are entitled to claim the same federal benefits available to opposite-sex married couples.
Opinion polls show that most Americans support gay marriage.
Twelve US states and the District of Columbia recognise gay marriage, while more than 30 states ban it.
The US Supreme Court is also due to decide within minutes a second case concerning a California law that bans same-sex marriage in that state.
The legal challenge to Doma was brought by New York resident Edith Windsor, 83.
She was handed a tax bill of $363,000 when she inherited the estate of her spouse Thea Speyer - a levy she would not have had to pay if she had been married to a man.
Lower courts ruled in Ms Windsor's favour, saying that Doma did not treat all married couples equally.