However, the bans will remain in place because U.S. District Judge Orlando Garcia in San Antonio also issued a stay pending appeal, the San Antonio Express-News reported.
Garcia said the ban -- approved by voters in 2005 -- demeans the dignity of gay couples "for no legitimate reason," NBC News reported.
"Without a rational relation to a legitimate governmental purpose, state-imposed inequality can find no refuge in our United States Constitution," the judge wrote.
Two same-sex couples sued the state to try to overturn the bans. One couple went to Massachusetts to get married, and they want Texas to recognize the union. The second couple, in a 17-year relationship, said they want to get married in their home state.
In his ruling, Garcia said the couples met the criteria for a preliminary injunction, including the likelihood of winning their legal challenge, the Express-News said.
"What it really marks is one more voice -- that of Judge Garcia's -- joining the chorus that is arising around the country on same-sex marriage and marriage equality," Barry Chasnoff, one of the couples' lawyers, told NBC News. "All our clients ever wanted was the right to be treated with respect and dignity and this judge says they should have it."
One of the suing couples, Mark Phariss and Vic Holmes, said in a statement they were "happy beyond words" with Garcia's decision.
"Having been together almost 17 years, we look forward to the day when we can get married and when all gay Texans enjoy equal rights to marry as well," the statement said.
Gov. Rick Perry said in a statement: "Texans spoke loud and clear by overwhelmingly voting to define marriage as a union between a man and a woman in our Constitution, and it is not the role of the federal government to overturn the will of our citizens. The 10th Amendment guarantees Texas voters the freedom to make these decisions, and this is yet another attempt to achieve via the courts what couldn't be achieved at the ballot box. We will continue to fight for the rights of Texans to self-determine the laws of our state."