WASHINGTON — All same-sex couples who are legally married will be recognized as such for federal tax purposes, even if the state where they live does not recognize their union, the Treasury Department and the Internal Revenue Service said Thursday.

It is the broadest federal rule change to come out of the landmark Supreme Court decision in June that struck down the 1996 Defense of Marriage Act, and a sign of how quickly the government is moving to treat gay couples in the same way that it does straight couples.

The June decision found that same-sex couples were entitled to federal benefits, but left open the question of how Washington would actually administer them. The Treasury Department answered some of those questions on Thursday. As of the 2013 tax year, same-sex spouses who are legally married will not be able to file federal tax returns as if either were single. Instead, they must file together as “married filing jointly” or individually as “married filing separately.”

Their address or the location of their wedding does not matter, as long as the marriage is legal: a same-sex couple who marry in Albany, N.Y., and move to Alabama are treated the same as a same-sex couple who marry and live in Massachusetts.