The ruling comes just weeks after the Supreme Court on June 26 invalidated a key portion of a 1996 federal law, known as the Defense of Marriage Act, that barred recognition of gay marriages.
(Read more: Wal-Mart onboard with partner benefits)
There was some uncertainty after the Supreme Court ruling about how the tax status of gay married couples would be treated in states that do not allow gay marriage.
"Today's ruling provides certainty and clear, coherent tax filing guidance for all legally married same-sex couples nationwide. It provides access to benefits, responsibilities and protections under federal tax law that all Americans deserve," Treasury Secretary Jack Lew said in a statement.
"This ruling also assures legally married same-sex couples that they can move freely throughout the country knowing that their federal filing status will not change," he said.
There are about 130,000 same-sex married couples in the United States, according to estimates from the Census Bureau.
A separate Supreme Court ruling in June made California the 13th of the 50 U.S. states to recognize gay marriage. The District of Columbia also recognizes gay marriage.